OFFSET
1,4
COMMENTS
There is such a prime for all n except for n = 1, 2, 3, and 6.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
C. A. Nicol and J. L. Selfridge, Problem E 3452, Elementary Problems, The American Mathematical Monthly, Vol. 98, No. 7 (1991), p. 645; Extraneous Primes, Solution to Problem E 3452 by David Callan and Kenneth Rogers, ibid., Vol. 100, No. 4 (1993), p. 404; Comment by Gerry Myerson, ibid., Vol. 100, No. 10 (1993), p. 959.
MATHEMATICA
a[n_] := Module[{phi = EulerPhi[n], p = 2}, While[Divisible[n, p] || PowerMod[2, phi, p] != 1, p = NextPrime[p]]; p]; a[1] = a[2] = a[3] = a[6] = 0; Array[a, 100]
PROG
(PARI) a(n) = {my(phi = eulerphi(n), p = 2); if(6 % n == 0, 0, while(!(n%p) || Mod(2, p)^phi != 1, p = nextprime(p+1)); p); }
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Amiram Eldar, Sep 07 2024
STATUS
approved