%I #30 May 24 2017 04:39:36
%S 2,11,349,13691,24329
%N Least prime p such that q^(p-1) == 1 (mod p^2) for n primes q < p.
%C I found no new terms < 5*10^6. - _J. Stauduhar_, Mar 23 2013
%C a(5) > 13*10^6, if it exists. Note that, up to 13*10^6, the only other prime p (apart 24329) such that the congruence is satisfied for 4 primes q < p is 9656869. - _Giovanni Resta_, May 23 2017
%D L. E. Dickson, History of the Theory of Numbers, vol. 1, chap. IV.
%H W. Keller and J. Richstein, <a href="http://www1.uni-hamburg.de/RRZ/W.Keller/FermatQuotient.html">Fermat quotients that are divisible by p</a>. [Broken link]
%H Wilfrid Keller and Jörg Richstein, <a href="https://doi.org/10.1090/S0025-5718-04-01666-7">Solutions of the congruence a^(p-1) == 1 (mod (p^r))</a>, Math. Comp. 74 (2005), 927-936.
%e For the prime p = 349, but for no smaller prime, there are 2 primes q = 223 and 317 < p with q^(p-1) == 1 (mod p^2), so a(2) = 349.
%t f[n_] := Block[{p = 2, q = {}}, While[ Count[ PowerMod[ q, p - 1, p^2], 1] != n, q = Join[q, {p}]; p = NextPrime@ p]; p]; Array[f, 5, 0] (* _Robert G. Wilson v_, Mar 09 2015 *)
%o (PARI) a(n) = {nb = 0; p = 2; while (nb != n, p = nextprime(p+1); nb = 0; forprime(q=2, p-1, if (Mod(q, p^2)^(p-1) == 1, nb ++); if (nb > n, break););); p;} \\ _Michel Marcus_, Mar 08 2015
%Y Cf. A001220, A039678, A134307, A143548, A222184, A222185.
%K nonn,more
%O 0,1
%A _Jonathan Sondow_, Feb 12 2013