login
A103309
Smallest prime primitive root of n that is less than n, or 0 if none exists.
7
0, 0, 0, 2, 3, 2, 5, 3, 0, 2, 3, 2, 0, 2, 3, 0, 0, 3, 5, 2, 0, 0, 7, 5, 0, 2, 7, 2, 0, 2, 0, 3, 0, 0, 3, 0, 0, 2, 3, 0, 0, 7, 0, 3, 0, 0, 5, 5, 0, 3, 3, 0, 0, 2, 5, 0, 0, 0, 3, 2, 0, 2, 3, 0, 0, 0, 0, 2, 0, 0, 0, 7, 0, 5, 5, 0, 0, 0, 0, 3, 0, 2, 7, 2, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 5, 0, 0, 5, 3, 0, 0, 2, 0, 5, 0
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
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