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.

A033948 Numbers that have a primitive root (the multiplicative group modulo n is cyclic).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 17, 18, 19, 22, 23, 25, 26, 27, 29, 31, 34, 37, 38, 41, 43, 46, 47, 49, 50, 53, 54, 58, 59, 61, 62, 67, 71, 73, 74, 79, 81, 82, 83, 86, 89, 94, 97, 98, 101, 103, 106, 107, 109, 113, 118, 121, 122, 125, 127, 131, 134, 137, 139
Offset: 1

Views

Author

Calculated by Jud McCranie, entered by N. J. A. Sloane

Keywords

Comments

The sequence consists of 1, 2, 4 and numbers of the form p^i and 2p^i, where p is an odd prime and i >= 1.
Sequence gives values of n such that x^2 == 1 (mod n) has no solution with 1 < x < n-1. - Benoit Cloitre, Jan 04 2002
Gaussian criterion for terms of the sequence: n is in the sequence iff Product_{1<=i<=n-1, gcd(i,n)=1} i == -1 (mod n), see example. - Vladimir Shevelev, Jan 11 2011
For the criterion used above see the Hardy and Wright reference, Theorem 129. p. 102, a consequence of Bauer's theorem. See also T. D. Noe's comment with the Nagell reference on A060594 and also A160377. - Wolfdieter Lang, Feb 16 2012
Also numbers n such that phi(n) = lambda(n) (or numbers with A034380(n)=1), where phi is A000010, and lambda is Carmichael's lambda: A002322. - Enrique Pérez Herrero, Jun 04 2013
All values of n>2 are given when there are exactly two solutions for n*j+1 is a square, 0 <= j < n, which are j = {0, n-2}. See Mathematica examples. - Richard R. Forberg, Mar 26 2016
Numbers n such that the Galois group of the cyclotomic field with the n-th roots of unity is a cyclic group. [Van der Waerden, p. 55, Th. 4.11.; Corwin, 1967] - N. J. A. Sloane, Nov 26 2016

Examples

			Gaussian product for n=9 is 1*2*4*5*7*8=2240. Since 2240==-1(mod 9), then 9 is in the sequence. - _Vladimir Shevelev_, Jan 11 2011
		

References

  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Fifth ed., Clarendon Press, Oxford, 2003, Theorem 129, p. 102.
  • I. Niven and H. S. Zuckerman, An Introduction to the Theory of Numbers, 4th edition, page 62, Theorem 2.25.
  • B. L. van der Waerden, Modern Algebra, 2nd. ed., Ungar, NY, Vol. I, 1948.

Crossrefs

Cf. A033949 (complement), A072209, A001783 (Gaussian products used in the V. Shevelev example).
Union of 1, 2, 4, A061345, A278568.

Programs

  • Maple
    m := proc(n) local k, r; r := 1; if n = 2 then return false fi;
    for k from 1 to n do if igcd(n,k) = 1 then r := modp(r*k,n) fi od; r end:
    select(n -> m(n) <> 1, [$1..139]); # Peter Luschny, May 25 2017
  • Mathematica
    Join[{1}, Select[ Range[140], IntegerQ[ PrimitiveRoot[#]] &]] (* Jean-François Alcover, Sep 27 2011 *)
    Select[Range[139], EulerPhi[#] == CarmichaelLambda[#] &] (* T. D. Noe, Jun 04 2013 *)
    result = {}; Do[count = 0;
    Do[If[Mod[j^2, n] == 1, count++], {j, 2, n - 2}];
    If[count == 0, AppendTo[result, n]], {n, 1, 200}]; result (* Richard R. Forberg, Mar 26 2016 *)
    result = {}; Do[count = 0;
    Do[ r = Sqrt[n*j + 1]; If[IntegerQ[r], count++], {j, 0, n}];
    If[count == 2, AppendTo[result, n]], {n, 0, 200}]; result  (* missing{1,2} Richard R. Forberg, Mar 26 2016 *)
  • PARI
    is(n)=if(n%2, isprimepower(n) || n==1, n==2 || n==4 || (isprimepower(n/2,&n) && n>2)) \\ Charles R Greathouse IV, Apr 16 2015
    
  • Python
    from sympy import primepi, integer_nthroot
    def A033948(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return int(n-1+x-(x>=2)-(x>=4)-sum(primepi(integer_nthroot(x,k)[0])-1 for k in range(1,x.bit_length()))-sum(primepi(integer_nthroot(x>>1,k)[0])-1 for k in range(1,x.bit_length()-1)))
        return bisection(f,n,n) # Chai Wah Wu, Feb 24 2025