OFFSET
1,1
COMMENTS
First number m coprime to p = p_n such that p does not divide q_p(m), where q_p(m) = (m^(p-1) - 1)/p is the Fermat quotient of p to the base m.
It is known that a(n) = O((log p_n)^2) as n -> oo. It is conjectured that a(n) = 3 if p_n is a Wieferich prime. See Section 1.1 in Ostafe-Shparlinski (2010).
Additional comments, references, links, and cross-refs are in A001220.
a(n) > 3 iff prime(n) is a term of both A001220 and A014127, i.e., iff A240987(n) = 2. - Felix Fröhlich, Jul 09 2016
LINKS
A. Ostafe and I. Shparlinski, Pseudorandomness and Dynamics of Fermat Quotients, arXiv:1001.1504 [math.NT], 2010.
Wikipedia, Generalized Wieferich primes
FORMULA
EXAMPLE
p_1 = 2 and 2^2 divides 1^(2-1) - 1 = 0 but not 3^(2-1) - 1 = 2, so a(1) = 3.
p_4 = 7 and 7^2 does not divide 2^(7-1) - 1 = 63, so a(4) = 2.
p_183 = 1093 and 1093^2 divides 2^1092 - 1 but not 3^1092 - 1, so a(183) = 3.
Similarly, p_490 = 3511 and a(490) = 3. See A001220.
MATHEMATICA
Table[b = 2; While[PowerMod[b, Prime[n] - 1, #^2] == 1 || GCD[b, #] > 1, b++] &@ Prime@ n; b, {n, 120}] (* Michael De Vlieger, Jul 09 2016 *)
PROG
(PARI) a(n) = my(b=2, p=prime(n)); while(Mod(b, p^2)^(p-1)==1 || gcd(b, p) > 1, b++); b \\ Felix Fröhlich, Jul 09 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonathan Sondow, Jun 17 2010, Jun 24 2010, Jun 25 2010
STATUS
approved