OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..1000
W. Keller and J. Richstein, Fermat quotients that are divisible by p.
MAPLE
a:= proc(p)
local q;
q:= 3;
while (q &^ (p-1) - 1) mod p^2 <> 0 do
q:= nextprime(q)
od:
q
end proc:
seq(a(ithprime(n)), n=1..100); # Robert Israel, Nov 24 2014
MATHEMATICA
Table[Function[p, q = 3; While[! Divisible[q^(p - 1) - 1, p^2], q = NextPrime@ q]; q]@ Prime@ n, {n, 54}] (* Michael De Vlieger, Feb 12 2017 *)
PROG
(PARI) a(n) = {p = prime(n); forprime(q=3, , if (Mod(q, p^2)^(p-1) == 1, return (q)); ); } \\ Michel Marcus, Nov 24 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Alexander Adamchuk, Nov 28 2006
EXTENSIONS
Removed an incorrect comment. - Felix Fröhlich, Feb 12 2017
STATUS
approved