cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A306252 Least primitive root mod A033948(n).

This page as a plain text file.
%I A306252 #27 May 09 2021 06:23:17
%S A306252 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,
%T A306252 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,
%U A306252 6,5,3,5,2,5,5,2,2,3,2,2,19,5,5,2,3,3,5
%N A306252 Least primitive root mod A033948(n).
%C A306252 Let U(k) denote the multiplicative group mod k. a(n) = smallest generator for U(A033948(n)). - _N. J. A. Sloane_, Mar 10 2019
%H A306252 Robert Israel, <a href="/A306252/b306252.txt">Table of n, a(n) for n = 1..10000</a>
%e A306252 For n=2, A033948(2) = 2, U(2) is generated by 1.
%e A306252 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.
%p A306252 0,op(subs(FAIL=NULL, map(numtheory:-primroot,[$2..1000]))); # _Robert Israel_, Mar 10 2019
%t A306252 Array[Take[PrimitiveRootList@ #, UpTo[1]] &, 210] // Flatten (* _Michael De Vlieger_, Feb 02 2019 *)
%o A306252 (Python)
%o A306252 from math import gcd
%o A306252 roots = [0]
%o A306252 for n in range(2,140):
%o A306252     # find U(n)
%o A306252     un = [i for i in range(1,n) if gcd(i,n) == 1]
%o A306252     # for each element in U(n), check if it's a generator
%o A306252     order = len(un)
%o A306252     is_cyclic = False
%o A306252     for cand in un:
%o A306252         is_gen = True
%o A306252         run = 1
%o A306252         # If it cand^x = 1 for some x < order, it's not a generator
%o A306252         for _ in range(order-1):
%o A306252             run = (run * cand) % n
%o A306252             if run == 1:
%o A306252                 is_gen = False
%o A306252                 break
%o A306252         if is_gen:
%o A306252             roots.append(cand)
%o A306252             is_cyclic = True
%o A306252             break
%o A306252 print(roots)
%Y A306252 Cf. A033948 (numbers that have a primitive root), A306253, A081888 (positions of records), A081889 (record values). First column of A046147.
%K A306252 nonn
%O A306252 1,3
%A A306252 _Charles Paul_, Feb 01 2019
%E A306252 More terms from _Michael De Vlieger_, Feb 02 2019
%E A306252 Edited by _N. J. A. Sloane_, Mar 10 2019
%E A306252 Edited by _Robert Israel_, Mar 10 2019