OFFSET
1,1
COMMENTS
a(n) <= n-2 for n > 2; a(p) = p-2 if p is a prime > 2. [Comment corrected by Floris van Doorn, Jan 31 2009]
a(n) = n - 2 precisely when n > 2 has a primitive root; that is, for 4, and p^k and 2*p^k for p an odd prime and k > 0. [From Franklin T. Adams-Watters, Apr 13 2009]
REFERENCES
Dorin Andrica, Vlad Crişan, The smallest nontrivial solution to x^k == 1 (mod n) ..., Amer. Math. Monthly 126 (2019), 173-178.
LINKS
Floris P. van Doorn, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = ((A215653(n))^2-1)/n.
MATHEMATICA
Do[k = 1; While[ !IntegerQ[Sqrt[n*k + 1]], k++ ]; Print[k], {n, 1, 85}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Oct 19 2002
EXTENSIONS
Edited and extended by Robert G. Wilson v, Oct 21 2002
STATUS
approved