login
A306252
Least primitive root mod A033948(n).
4
0, 1, 2, 3, 2, 5, 3, 2, 3, 2, 2, 3, 3, 5, 2, 7, 5, 2, 7, 2, 2, 3, 3, 2, 3, 6, 3, 5, 5, 3, 3, 2, 5, 3, 2, 2, 3, 2, 7, 5, 5, 3, 2, 7, 2, 3, 3, 5, 5, 3, 2, 5, 3, 2, 6, 3, 11, 2, 7, 2, 3, 2, 7, 3, 2, 7, 5, 2, 6, 5, 3, 5, 2, 5, 5, 2, 2, 3, 2, 2, 19, 5, 5, 2, 3, 3, 5
OFFSET
1,3
COMMENTS
Let U(k) denote the multiplicative group mod k. a(n) = smallest generator for U(A033948(n)). - N. J. A. Sloane, Mar 10 2019
LINKS
EXAMPLE
For n=2, A033948(2) = 2, U(2) is generated by 1.
For n=14, A033948(14) = 18, and U(18) is generated by both 5 and 11; here we select the smallest generator, 5, so a(14) = 5.
MAPLE
0, op(subs(FAIL=NULL, map(numtheory:-primroot, [$2..1000]))); # Robert Israel, Mar 10 2019
MATHEMATICA
Array[Take[PrimitiveRootList@ #, UpTo[1]] &, 210] // Flatten (* Michael De Vlieger, Feb 02 2019 *)
PROG
(Python)
from math import gcd
roots = [0]
for n in range(2, 140):
# find U(n)
un = [i for i in range(1, n) if gcd(i, n) == 1]
# for each element in U(n), check if it's a generator
order = len(un)
is_cyclic = False
for cand in un:
is_gen = True
run = 1
# If it cand^x = 1 for some x < order, it's not a generator
for _ in range(order-1):
run = (run * cand) % n
if run == 1:
is_gen = False
break
if is_gen:
roots.append(cand)
is_cyclic = True
break
print(roots)
CROSSREFS
Cf. A033948 (numbers that have a primitive root), A306253, A081888 (positions of records), A081889 (record values). First column of A046147.
Sequence in context: A369029 A007967 A054494 * A112764 A108728 A331962
KEYWORD
nonn
AUTHOR
Charles Paul, Feb 01 2019
EXTENSIONS
More terms from Michael De Vlieger, Feb 02 2019
Edited by N. J. A. Sloane, Mar 10 2019
Edited by Robert Israel, Mar 10 2019
STATUS
approved