%I #13 Nov 30 2017 04:45:33
%S 2,3,5,7,17,23,89,113,137,149,163,181,191,233,257,263,277,283,397,419,
%T 421,443,449,461,463,509,557,569,593,599,613,619,701,719,821,823,829,
%U 857,863,877,919,1097,1103,1117,1171,1181,1193,1213,1237,1259,1361,1367
%N a(1)=2, a(n) is the smallest prime > a(n-1) such that a(n) is a primitive root mod a(n-1) and vice versa.
%C if a(n) is 3 mod 4, then by quadratic reciprocity, if q is 3 mod 4, then either q is a square mod a(n) or vice versa, so a(n+1) must be 1 mod 4.
%H Iain Fox, <a href="/A107439/b107439.txt">Table of n, a(n) for n = 1..10000</a>
%e a(5)=17 because 7 is a primitive root mod 17 and 17 (=3 mod 7) is a primitive root mod 7. Also a(5) is not 11 since 11 has order 3 mod 7, a(5) is not 13 since 13 has order 2 mod 7.
%o (PARI) first(n) = { my(res=vector(n)); res[1]=2; for(x=2, n, forprime(p=res[x-1]+1, , if(znorder(Mod(p, res[x-1]))==(res[x-1]-1) && znorder(Mod(res[x-1], p))==(p-1), res[x]=p; break()))); res; } \\ _Iain Fox_, Nov 29 2017
%K nonn
%O 1,1
%A _John L. Drost_, May 26 2005
|