close
login
A214158
Smallest number with n as least nonnegative primitive root, or 0 if no such number exists.
3
1, 2, 3, 4, 0, 6, 41, 22, 0, 0, 313, 118, 4111, 457, 1031, 439, 0, 262, 53173, 191, 107227, 362, 3361, 842, 533821, 0, 12391, 0, 133321, 2906, 124153, 2042, 0, 3062, 48889, 2342, 0, 7754, 55441, 19322, 1373989, 3622, 2494381, 16022, 71761, 613034, 273001, 64682, 823766851, 0, 23126821, 115982, 129361, 29642
OFFSET
0,2
COMMENTS
a(A001597(n)) = 0 for n > 1.
LINKS
Sean A. Irvine, Table of n, a(n) for n = 0..251 (contains -1 where a term has not yet been found, updates previous list from Robert G. Wilson v)
G. L. Honaker, Jr. and Chris Caldwell, Prime Curios! 313
Eric Weisstein's World of Mathematics, Primitive Root
EXAMPLE
a(7) = 22, since 22 has 7 as smallest positive primitive root and no number < 22 has 7 as smallest positive primitive root.
MATHEMATICA
lst2 = {}; r = 47; smallestPrimitiveRoot[n_ /; n <= 1] = 0; smallestPrimitiveRoot[n_] := Block[{pr = PrimitiveRoot[n], g}, If[! NumericQ[pr], g = 0, g = 1; While[g <= pr, If[CoprimeQ[g, n] && MultiplicativeOrder[g, n] == EulerPhi[n], Break[]]; g++]]; g]; lst1 = Union[Flatten@Table[n^i, {i, 2, Log[2, r]}, {n, 2, r^(1/i)}]]; Do[n = 2; If[MemberQ[lst1, l], AppendTo[lst2, 0], While[True, If[smallestPrimitiveRoot[n] == l, AppendTo[lst2, n]; Break[]]; n++]], {l, r}]; Prepend[lst2, 1] (* Most of the code is from Jean-François Alcover *)
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved