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.

Showing 1-2 of 2 results.

A306252 Least primitive root mod A033948(n).

Original entry on oeis.org

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

Views

Author

Charles Paul, Feb 01 2019

Keywords

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

Examples

			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.
		

Crossrefs

Cf. A033948 (numbers that have a primitive root), A306253, A081888 (positions of records), A081889 (record values). First column of A046147.

Programs

  • 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 *)
  • 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)

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

A081888 Numbers n such that the least positive primitive root of n is larger than the value for all positive numbers smaller than n.

Original entry on oeis.org

1, 3, 4, 6, 22, 118, 191, 362, 842, 2042, 2342, 3622, 16022, 29642, 66602, 110881, 143522, 535802, 5070662, 6252122, 6497402, 10219442, 69069002, 1130187962
Offset: 1

Views

Author

Sven Simon, Mar 30 2003

Keywords

Comments

A081889 gives the primitive roots itself. Difference from A002229, A002230: In consideration of all n having primitive roots. A002229, A002230 only primes.

Crossrefs

Cf. A081889, A002229, A002230. Positions of records of A306252.

Programs

  • Maple
    a306252 := proc(n::integer)
        local r;
        r := numtheory[primroot](n) ;
        if r <> FAIL then
            return r ;
        else
            return -1 ;
        end if;
    end proc:
    A081888 := proc()
        local rec,n,lpr ;
        rec := -1 ;
        for n from 1 do
            lpr := a306252(n) ;
            if lpr > rec then
                printf("%d,\n",n) ;
                rec := lpr ;
            end if;
        end do:
    end proc:
    A081888() ; # R. J. Mathar, Apr 04 2019
  • Mathematica
    nmax = 10^5;
    r[n_] := r[n] = Module[{prl = PrimitiveRootList[n]}, If[prl == {}, -1, prl[[1]]]]; r[1] = 1;
    Reap[Module[{rec = -1, n, lpr}, For[n = 1, n <= nmax, n++, lpr = r[n]; If[lpr > rec, Print[n, " ", lpr]; Sow[n]; rec = lpr]]]][[2, 1]] (* Jean-François Alcover, Jun 19 2023, after R. J. Mathar *)
  • Python
    from sympy import primitive_root
    from itertools import count, islice
    def f(n): r = primitive_root(n); return r if r != None else 0
    def agen(r=0): yield from ((m, r:=f(m))[0] for m in count(1) if f(m) > r)
    print(list(islice(agen(), 18))) # Michael S. Branicky, Feb 13 2023

Formula

Numbers 1, 2, 4, p^m and 2*p^m have primitive roots for odd primes p and m >=1 natural number.

Extensions

a(24) from Michael S. Branicky, Feb 20 2023
Showing 1-2 of 2 results.