A103309 Smallest prime primitive root of n that is less than n, or 0 if none exists.
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
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.
Programs
-
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 *)
Comments