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-10 of 28 results. Next

A380604 Numbers k such that there is no number i such that A046144(i) = 2*k.

Original entry on oeis.org

7, 13, 15, 17, 19, 21, 23, 25, 28, 29, 31, 33, 34, 35, 37, 38, 39, 43, 45, 47, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 79, 83, 85, 87, 91, 92, 93, 94, 97, 98, 99, 101, 103, 104, 105, 107, 109, 111, 112, 113, 114, 115, 117, 118
Offset: 1

Views

Author

David James Sycamore, Jan 28 2025

Keywords

Comments

2*a(n) are the even numbers which are not in A378508, namely numbers 2*m for which no number exists which has 2*m primitive roots. See A380594 for discussion of even numbers which are not in this sequence.

Examples

			 There is no x such that A046144(x) = 14, so 7 is a term in this sequence (see also A380594).
		

Crossrefs

Programs

A379883 a(1) = 1. Let j = a(n-1) and r = A046144(j). Then for n > 1, if j is novel and r > 0, a(n) = r. If j is novel and r = 0 then a(n) = 1. If j has occurred k (>1) times already then a(n) = k*j.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 4, 1, 5, 2, 4, 8, 1, 6, 1, 7, 2, 6, 12, 1, 8, 16, 1, 9, 2, 8, 24, 1, 10, 2, 10, 20, 1, 11, 4, 12, 24, 48, 1, 12, 36, 1, 13, 4, 16, 32, 1, 14, 2, 12, 48, 96, 1, 15, 1, 16, 48, 144, 1, 17, 8, 32, 64, 1, 18, 2, 14, 28, 1, 19, 6, 18, 36, 72, 1, 20, 40, 1, 21, 1, 22, 4, 20, 60, 1, 23, 10, 30, 1, 24, 72, 144, 288, 1, 25, 8, 40, 80, 1, 26, 4
Offset: 1

Views

Author

David James Sycamore, Jan 09 2025

Keywords

Comments

In other words if j = a(n-1) has not occurred earlier and has r (> 0) primitive roots then a(n) = r. Cases where novel A046144(j) = 0 cannot be counted multiplicatively (as k*j) for repeats, so a(n) = 1 is designed to permit the sequence to continue past such points, which means including in the count of 1's terms following (1,2,3,4,6), for which it is true that r = 1. Terms beyond a(12) = 8 which count the number of 1's (by the second condition) give the cardinality of terms with no primitive roots, plus the few (5) cases of terms with primitive root = 1.
Every even number m in A380594 appears finitely many times, consequent to occasions of integers v (>6) for which A046144(v) = m, and to repetitions (k*j) = m for j even. However every odd number appears once only (consequent to odd counts of 1's). The odd numbers appear in order, and since 2 precedes all of them, the primes are in order.

Examples

			a(2) = 1 since a(1)=1 and and 1 has one primitive root. Since 1 has been seen twice, a(3) = 2 and then a(4) = 1 since 2 is a novel term with one primitive root.
a(9) = 5, a novel term with two primitive roots so a(10) = 2, which has appeared once before (a(3)=2), so a(11) = 4, the second occurrence of 4 so a(12) = 8, a novel term with no primitive roots, meaning that a(13) = 1. The count of 1's is now 6, so a(14) = 6, meaning 5 prior terms with one primitive root and one with none.
		

Crossrefs

Programs

  • Mathematica
    nn = 120; c[_] := 0; j = 1;
    f[x_] := f[x] = Which[
      x == 1, 1,
      IntegerQ[PrimitiveRoot[x]], Nest[EulerPhi, x, 2],
      True, 0];
    {j}~Join~Reap[Monitor[Do[
      If[c[j] == 0,
        Set[k, # + Boole[# == 0]] &[f[j]]; c[j]++,
        k = ++c[j]*j ];
    j = Sow[k], {n, 2, nn}], n] ][[-1, 1]] (* Michael De Vlieger, Jan 09 2025 *)

Extensions

a(78)=1 inserted by David Radcliffe, Aug 03 2025

A010554 a(n) = phi(phi(n)), where phi is the Euler totient function.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 4, 2, 4, 2, 4, 4, 8, 2, 6, 4, 4, 4, 10, 4, 8, 4, 6, 4, 12, 4, 8, 8, 8, 8, 8, 4, 12, 6, 8, 8, 16, 4, 12, 8, 8, 10, 22, 8, 12, 8, 16, 8, 24, 6, 16, 8, 12, 12, 28, 8, 16, 8, 12, 16, 16, 8, 20, 16, 20, 8, 24, 8
Offset: 1

Views

Author

Keywords

Comments

If n has a primitive root, then it has exactly phi(phi(n)) of them (Burton 1989, p. 188), which means that if p is a prime number, then there are exactly phi(p-1) incongruent primitive roots of p (Burton 1989). - Jonathan Vos Post, Sep 10 2010
See A046144 for the number of primitive roots mod n. - Wolfdieter Lang, Mar 09 2012

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 840.
  • Burton, D. M. "The Order of an Integer Modulo n," "Primitive Roots for Primes," and "Composite Numbers Having Primitive Roots." Sections 8.1-8.3 in Elementary Number Theory, 4th ed. Dubuque, IA: William C. Brown Publishers, pp. 184-205, 1989.

Crossrefs

Programs

A046145 Smallest primitive root modulo n, or 0 if no root exists.

Original entry on oeis.org

0, 0, 1, 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, 6, 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
Offset: 0

Views

Author

Keywords

Comments

The value 0 at index 0 says 0 has no primitive roots, but the 0 at index 1 says 1 has a primitive root of 0, the only real 0 in the sequence.
a(n) is nonzero if and only if n is 2, 4, or of the form p^k, or 2*p^k where p is an odd prime and k>0. - Tom Edgar, Jun 02 2014

Crossrefs

Programs

  • Maple
    A046145 := proc(n)
      if n <=1 then
        0;
      else
        pr := numtheory[primroot](n) ;
        if pr = FAIL then
           return 0 ;
        else
           return pr ;
        end if;
      end if;
    end proc:
    seq(A046145(n),n=0..110) ;  # R. J. Mathar, Jul 08 2010
  • Mathematica
    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]; smallestPrimitiveRoot /@ Range[0, 100] (* Jean-François Alcover, Feb 15 2012 *)
    f[n_] := Block[{pr = PrimitiveRootList[n]}, If[pr == {}, 0, pr[[1]]]]; Array[f, 105, 0] (* v10.0 Robert G. Wilson v, Nov 04 2014 *)
  • PARI
    { A046145(n) = for(q=1,n-1, if(gcd(q,n)==1 && znorder(Mod(q,n))==eulerphi(n), return(q);)); 0; } /* V. Raman, Nov 22 2012, edited by Max Alekseyev, Apr 20 2017 */
    
  • Perl
    use ntheory ":all"; say "$ ", znprimroot($) || 0  for 0..100; # Dana Jacobsen, Mar 16 2017

Extensions

Initial terms corrected by Harry J. Smith, Jan 27 2005

A046146 Largest primitive root modulo n, or 0 if no root exists.

Original entry on oeis.org

0, 0, 1, 2, 3, 3, 5, 5, 0, 5, 7, 8, 0, 11, 5, 0, 0, 14, 11, 15, 0, 0, 19, 21, 0, 23, 19, 23, 0, 27, 0, 24, 0, 0, 31, 0, 0, 35, 33, 0, 0, 35, 0, 34, 0, 0, 43, 45, 0, 47, 47, 0, 0, 51, 47, 0, 0, 0, 55, 56, 0, 59, 55, 0, 0, 0, 0, 63, 0, 0, 0, 69, 0, 68, 69, 0, 0, 0, 0, 77, 0, 77, 75, 80, 0, 0
Offset: 0

Views

Author

Keywords

Comments

The value 0 at index 0 says 0 has no primitive roots, but the 0 at index 1 says 1 has a primitive root of 0, the only real 0 in the sequence. - Initial terms corrected by Harry J. Smith, Jan 27 2005
a(n) is nonzero if and only if n is 2, 4, or of the form p^k, or 2*p^k where p is an odd prime and k>0. - Tom Edgar, Jun 02 2014

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{pr = PrimitiveRootList[n]}, If[pr == {}, 0, pr[[-1]]]]; Array[f, 86, 0] (* Robert G. Wilson v, Nov 03 2014 *)
  • PARI
    for(i=0,100,p=0;for(q=1,i-1,if(gcd(q,i)==1&&znorder(Mod(q,i))==eulerphi(i),p=q));print1(p",")) /* V. Raman, Nov 22 2012 */

Extensions

Initial terms corrected by Harry J. Smith, Jan 27 2005

A046147 Triangle read by rows in which row n lists the primitive roots mod n (omitting numbers n without a primitive root).

Original entry on oeis.org

1, 2, 3, 2, 3, 5, 3, 5, 2, 5, 3, 7, 2, 6, 7, 8, 2, 6, 7, 11, 3, 5, 3, 5, 6, 7, 10, 11, 12, 14, 5, 11, 2, 3, 10, 13, 14, 15, 7, 13, 17, 19, 5, 7, 10, 11, 14, 15, 17, 19, 20, 21, 2, 3, 8, 12, 13, 17, 22, 23, 7, 11, 15, 19, 2, 5, 11, 14, 20, 23, 2, 3, 8, 10, 11, 14, 15, 18, 19, 21, 26
Offset: 2

Views

Author

Keywords

Examples

			n followed by primitive roots, if any:
1 -
2 1
3 2
4 3
5 2 3
6 5
7 3 5
8 -
9 2 5
10 3 7
11 2 6 7 8
12 -
13 2 6 7 11
...
		

Crossrefs

Cf. A001918, A046144 (row lengths), A046145, A046146.
Cf. A060749, A306252 (1st column), A306253 (last/maximum element)

Programs

  • Maple
    f:= proc(n) local p,k,m,R;
         p:= numtheory:-primroot(n);
         if p = FAIL then return NULL fi;
         m:= numtheory:-phi(n);
         k:= select(i -> igcd(i,m) = 1, [$1..m-1]);
         op(sort(map(t -> p&^t mod n, k)))
    end proc:
    f(2):= 1:
    map(f, [$2..50]); # Robert Israel, Apr 28 2017
  • Mathematica
    a[n_] := Select[Range[n-1], GCD[#, n] == 1 && MultiplicativeOrder[#, n] == EulerPhi[n]& ]; Table[a[n], {n, 1, 30}] // Flatten (* Jean-François Alcover, Oct 23 2012 *)
    PrimitiveRootList[Range[Prime[10]]]//Flatten (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 10 2016 *)
  • PARI
    a_row(r) = my(v=[], phi=eulerphi(r)); for(i=1, r-1, if(1 == gcd(r, i) && phi == znorder(Mod(i, r)), v=concat(v, i))); v \\ Ruud H.G. van Tol, Oct 23 2023

Extensions

Edited by Robert Israel, Apr 28 2017

A103309 Smallest prime primitive root of n that is less than n, or 0 if none exists.

Original entry on oeis.org

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

Views

Author

Harry J. Smith, Jan 29 2005

Keywords

Comments

Differs from A046145 only for indices n = 2, 41, 109, 151, 229, ...; see A103335. - Jeppe Stig Nielsen, Mar 06 2020

Crossrefs

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

A103310 Largest prime primitive root of n that is less than n, or 0 if none exists.

Original entry on oeis.org

0, 0, 0, 2, 3, 3, 5, 5, 0, 5, 7, 7, 0, 11, 5, 0, 0, 11, 11, 13, 0, 0, 19, 19, 0, 23, 19, 23, 0, 19, 0, 17, 0, 0, 31, 0, 0, 19, 29, 0, 0, 29, 0, 29, 0, 0, 43, 43, 0, 47, 47, 0, 0, 41, 47, 0, 0, 0, 47, 47, 0, 59, 53, 0, 0, 0, 0, 61, 0, 0, 0, 67, 0, 59, 61, 0, 0, 0, 0, 59, 0, 59, 71, 79, 0, 0, 73
Offset: 0

Views

Author

Harry J. Smith, Jan 29 2005

Keywords

Crossrefs

Programs

  • Maple
    hasproot:= proc(n)
      if n::odd then nops(numtheory:-factorset(n))=1
      else padic:-ordp(n,2)=1 and nops(numtheory:-factorset(n/2))=1
      fi
    end proc;
    hasproot(2):= true: hasproot(4):= true:
    f:= proc(n) local p,t;
      if not hasproot(n) then return 0 fi;
      t:= numtheory:-phi(n);
      p:= prevprime(n);
      while not numtheory:-order(p,n)=t do
        if p = 2 then return 0 fi;
        p:= prevprime(p);
      od;
      p
    end proc:
    f(0):= 0: f(1):= 0: f(2):= 0:
    map(f, [$0..100]); # Robert Israel, Sep 08 2020
  • Mathematica
    a[n_] := Module[{R = PrimitiveRootList[n], s}, s = Select[R, # < n && PrimeQ[#]&]; If[s == {}, 0, s[[-1]]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 01 2023 *)

A103335 Numbers whose smallest primitive root (A046145) is not prime.

Original entry on oeis.org

1, 2, 41, 109, 151, 229, 251, 271, 313, 337, 362, 367, 409, 439, 542, 626, 674, 733, 761, 818, 878, 971, 991, 1021, 1031, 1069, 1289, 1297, 1303, 1429, 1471, 1489, 1681, 1759, 1783, 1789, 1811, 1871, 1873, 1879, 2062, 2137, 2342, 2411, 2441, 2551, 2594
Offset: 1

Views

Author

Harry J. Smith, Jan 31 2005

Keywords

Crossrefs

Programs

  • Maple
    filter:= proc(n)
      local r;
      r:= numtheory:-primroot(n);
      r <> FAIL and not isprime(r)
    end proc:
    filter(1):= true:
    select(filter, [$1..3000]); Robert Israel, Sep 08 2020
  • Mathematica
    L = {}; Do[ If[!PrimeQ[ Min[ Select[ Range[n], CoprimeQ[#, n] && MultiplicativeOrder[#, n] == CarmichaelLambda[n] &]]],
    L = Append[L, n]], {n, 1, 3000}]; L (* Jonathan Sondow, May 17 2017 *)

Extensions

Offset changed by Robert Israel, Sep 08 2020

A219027 Number of non-primitive roots for n, less than n.

Original entry on oeis.org

0, 0, 1, 2, 2, 4, 4, 7, 6, 7, 6, 11, 8, 11, 14, 15, 8, 15, 12, 19, 20, 17, 12, 23, 16, 21, 20, 27, 16, 29, 22, 31, 32, 25, 34, 35, 24, 31, 38, 39, 24, 41, 30, 43, 44, 35, 24, 47, 36, 41, 50, 51, 28, 47, 54, 55, 56, 45, 30, 59, 44, 53, 62, 63, 64, 65, 46, 67, 68
Offset: 1

Views

Author

V. Raman, Nov 10 2012

Keywords

Comments

a(n) will be the same as A219029(n) except when n is a member of A033949 or n = 1, i.e. n is not 2, 4, prime, power of a prime, twice a prime, or twice a prime power. In such cases, when n is a member of A033949, then a(n) = n-1.

Crossrefs

Cf. A008330 (number of primitive roots for the n-th prime, less than n-th prime).
Cf. A046144 (number of primitive roots for n, less than n).
Cf. A010554 (value of phi(phi(n))).
Cf. A219029.

Programs

  • PARI
    for(i=1,100,p=0;for(q=1,i-1,if(gcd(q,i)>1||znorder(Mod(q,i))!=eulerphi(i),p++));print1(p","))

Formula

n-1-A046144(n).
Showing 1-10 of 28 results. Next