%I #19 May 13 2013 01:54:05
%S 2,3,5,2,3,3,2,5,2,5,2,3,2,2,2,7,3,3,3,2,2,2,3,2,2,5,2,3,2,2,2,3,2,5,
%T 5,2,2,5,2,13,3,3,2,2,7,2,5,2,3,2,2,2,2,2,2,2,5,2,2,2,2,17,2,2,2,7,2,
%U 2,3,3,2,2,2,3,5,2,5,2,2,2,3,3,2,2,2,3,2,2,5,2,3,2,2,3,2,2,5,2,3,3,3,7,3,2,2,2
%N a(n) is the least prime not a primitive root of n-th prime.
%H Charles R Greathouse IV, <a href="/A060084/b060084.txt">Table of n, a(n) for n = 1..10000</a>
%e a(8) = 5 because 19 is the 8th prime, primes 2 and 3 are primitive roots of 19, but 5 is not.
%p with(numtheory); for n from 1 to 100 do i := 1; while (i < n) and (primroot(ithprime(i) - 1, ithprime(n)) = ithprime(i)) do i := i+1; od; print( ithprime(i)); od:
%t Flatten[Table[Take[Complement[Prime[Range[25]], PrimitiveRoot[Prime[n]]], 1], {n, 100}]] (* _Alonso del Arte_, Oct 23 2012 *)
%o (PARI) a(n)=my(q=prime(n));forprime(p=2,q-1,if(znorder(Mod(p,q))<q-1,return(p)));q \\ _Charles R Greathouse IV_, Oct 26 2012
%Y Cf. A000040, A060085.
%K easy,nonn
%O 1,1
%A _Marc LeBrun_, Feb 23 2001
%E Corrected by _Jud McCranie_, Mar 14 2001. Checked by _N. J. A. Sloane_ Sep 03 2002.