OFFSET
0,4
COMMENTS
Differs from A046145 only for indices n = 2, 41, 109, 151, 229, ...; see A103335. - Jeppe Stig Nielsen, Mar 06 2020
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
G. Martin, The Least Prime Primitive Root and the Shifted Sieve, Acta Arith. 80 (1997), no. 3, 277-288; arXiv:math/9807104 [math.NT], 1998.
Eric Weisstein's World of Mathematics, Primitive Root.
MAPLE
F:= proc(n)
local r;
r:= numtheory:-primroot(n);
while r::integer and not isprime(r) do
r:= numtheory:-primroot(r, n);
od:
if r = FAIL then 0 else r fi
end proc:
seq(F(n), n=0..200); # Robert Israel, May 18 2015
MATHEMATICA
a[n_] := SelectFirst[PrimitiveRootList[n], PrimeQ[#] && # < n&] /. Missing["NotFound"] -> 0;
Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Nov 15 2017 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Harry J. Smith, Jan 29 2005
STATUS
approved