OFFSET
1,1
COMMENTS
a(n) is the smallest weak pseudoprime to base n that is > n.
If n is even and n+1 is composite, then a(n) = n+1. [Corrected by Thomas Ordowski, Aug 03 2018]
Conjecture: a(n) = n+1 if and only if n+1 is an odd composite number. - Thomas Ordowski, Aug 03 2018
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
Gérard P. Michon, Weak pseudoprimes to base a
MAPLE
L:=NULL: for a to 100 do for n from a+1 while isprime(n) or not(a^n - a mod n =0) do od; L:=L, n od: L;
MATHEMATICA
Table[k = n; While[k++; PrimeQ[k] || PowerMod[n, k, k] != n]; k, {n, 100}] (* T. D. Noe, Mar 17 2014 *)
PROG
(Haskell)
import Math.NumberTheory.Moduli (powerMod)
a239293 n = head [c | c <- a002808_list, powerMod n c c == n]
-- Reinhard Zumkeller, Jul 11 2014
(PARI) a(n) = forcomposite(c=n+1, , if(Mod(n, c)^c==n, return(c))) \\ Felix Fröhlich, Aug 03 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert FERREOL, Mar 14 2014
STATUS
approved