OFFSET
1,2
COMMENTS
According to the conjecture in A239957, a(n) should be always positive.
LINKS
Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
Z.-W. Sun, New observations on primitive roots modulo primes, arXiv preprint arXiv:1405.0290 [math.NT], 2014.
EXAMPLE
a(4) = 5 since 2^2 + 1 = 5 is a primitive root modulo prime(4) = 7, but neither 0^1 + 1 = 1 nor 1^1 + 1 = 2 is a primitive root modulo prime(4) = 7.
MATHEMATICA
f[k_]:=k^2+1
dv[n_]:=Divisors[n]
Do[Do[Do[If[Mod[f[k]^(Part[dv[Prime[n]-1], i]), Prime[n]]==1, Goto[aa]], {i, 1, Length[dv[Prime[n]-1]]-1}]; Print[n, " ", k^2+1]; Goto[bb]; Label[aa]; Continue, {k, 0, Sqrt[Prime[n]-2]}]; Print[n, " ", 0]; Label[bb]; Continue, {n, 1, 80}]
PROG
(PARI) ispr(n, p)=my(f=factor(p-1)[, 1], m=Mod(n, p)); for(i=1, #f, if(m^(p\f[i])==1, return(0))); m^(p-1)==1
a(n)=my(p=prime(n)); for(k=0, sqrtint(p-2), if(ispr(k^2+1, p), return(k^2+1))); 0 \\ Charles R Greathouse IV, May 01 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Zhi-Wei Sun, Apr 23 2014
STATUS
approved