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 35 results. Next

A001918 Least positive primitive root of n-th prime.

Original entry on oeis.org

1, 2, 2, 3, 2, 2, 3, 2, 5, 2, 3, 2, 6, 3, 5, 2, 2, 2, 2, 7, 5, 3, 2, 3, 5, 2, 5, 2, 6, 3, 3, 2, 3, 2, 2, 6, 5, 2, 5, 2, 2, 2, 19, 5, 2, 3, 2, 3, 2, 6, 3, 7, 7, 6, 3, 5, 2, 6, 5, 3, 3, 2, 5, 17, 10, 2, 3, 10, 2, 2, 3, 7, 6, 2, 2, 5, 2, 5, 3, 21, 2, 2, 7, 5, 15, 2, 3, 13, 2, 3, 2, 13, 3, 2, 7, 5, 2, 3, 2, 2, 2, 2, 2, 3
Offset: 1

Views

Author

Keywords

Comments

If k is a primitive root of p=4m+1, then p-k is too. If k is a primitive root of p=4m+3, then p-k isn't, but has order 2m+1. - Jon Perry, Sep 07 2014

Examples

			modulo 7: 3^6=1, 3^2=2, 3^7=3, 3^4=4, 3^5=5, 3^3=6, 7=prime(4), 3=a(4).
		

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. 864.
  • T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 213.
  • CRC Handbook of Combinatorial Designs, 1996, p. 615.
  • P. Fan and M. Darnell, Sequence Design for Communications Applications, Wiley, NY, 1996, Table A.1.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, th. 111.
  • Hua Loo Keng, Introduction To Number Theory, 'Table of least primitive roots for primes less than 50000', pp. 52-6, Springer NY 1982.
  • R. Osborn, Tables of All Primitive Roots of Odd Primes Less Than 1000, Univ. Texas Press, 1961.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 20.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A column of A060749. Cf. A002233.

Programs

  • Maple
    A001918 := proc(n)
            numtheory[primroot](ithprime(n)) ;
    end proc:
  • Mathematica
    Table[PrimitiveRoot@Prime@n, {n, 101}] (* Robert G. Wilson v, Dec 15 2005 *)
    PrimitiveRoot[Prime[Range[110]]] (* Harvey P. Dale, Jan 13 2013 *)
  • PARI
    for(x=1, 1000, print1(lift(znprimroot(prime(x))), ", "))
    
  • Python
    from sympy import prime
    from sympy.ntheory.residue_ntheory import primitive_root
    def A001918(n): return primitive_root(prime(n)) # Chai Wah Wu, Sep 13 2022
  • Sage
    [primitive_root(p) for p in primes(570)] # Zerinvary Lajos, May 24 2009
    

A088144 Sum of primitive roots of n-th prime.

Original entry on oeis.org

1, 2, 5, 8, 23, 26, 68, 57, 139, 174, 123, 222, 328, 257, 612, 636, 886, 488, 669, 1064, 876, 1105, 1744, 1780, 1552, 2020, 1853, 2890, 1962, 2712, 2413, 3536, 4384, 3335, 5364, 3322, 3768, 4564, 7683, 7266, 8235, 4344, 8021, 6176, 8274
Offset: 1

Views

Author

Ed Pegg Jr, Nov 03 2003

Keywords

Comments

It is a result that goes back to Mirsky that the set of primes p for which p-1 is squarefree has density A, where A denotes the Artin constant (A = Product_{q prime} (1-1/(q*(q-1)))). Numerically A = 0.3739558136.. = A005596. More precisely, Sum_{p <= x} mu(p-1)^2 = Ax/log x + o(x/log x) as x tends to infinity. Conjecture: sum_{p <= x, mu(p-1)=1} 1 = (A/2)x/log x + o(x/log x) and sum_{p <= x, mu(p-1)=-1} 1 = (A/2)x/log x + o(x/log x). - Pieter Moree (moree(AT)mpim-bonn.mpg.de), Nov 03 2003
The number of the primitive roots is A008330(n). - R. K. Guy, Feb 25 2011
If prime(n) == 1 (mod 4), then a(n) = prime(n)*A008330(n)/2. There are also primes of the form prime(n) == 3 (mod 4) where prime(n) | a(n), namely prime(n) = 19, 127, 151, 163, 199, 251,... The list of primes in both modulo-4 classes where prime(n)|a(n) is 5, 13, 17, 19, 29, 37, 41, 53, 61,... - R. K. Guy, Feb 25 2011
a(n) = A076410(n) at n = 1, 3, 7, 55,... (for p = 2, 5, 17, 257... and perhaps only for the Fermat primes). - R. K. Guy, Feb 25 2011

Examples

			For 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, the primitive roots are as follows: {{1}, {2}, {2, 3}, {3, 5}, {2, 6, 7, 8}, {2, 6, 7, 11}, {3, 5, 6, 7, 10, 11, 12, 14}, {2, 3, 10, 13, 14, 15}, {5, 7, 10, 11, 14, 15, 17, 19, 20, 21}, {2, 3, 8, 10, 11, 14, 15, 18, 19, 21, 26, 27}}
		

References

  • C. F. Gauss, Disquisitiones Arithmeticae, Yale, 1965; see p. 52.

Crossrefs

Programs

  • Mathematica
    PrimitiveRootQ[ a_Integer, p_Integer ] := Block[ {fac, res}, fac = FactorInteger[ p - 1 ]; res = Table[ PowerMod[ a, (p - 1)/fac[ [ i, 1 ] ], p ], {i, Length[ fac ]} ]; ! MemberQ[ res, 1 ] ] PrimitiveRoots[ p_Integer ] := Select[ Range[ p - 1 ], PrimitiveRootQ[ #, p ] & ]
    Total /@ Table[PrimitiveRootList[Prime[k]], {k, 1, 45}] (* Updated for Mathematica 13 by Harlan J. Brothers, Feb 27 2023 *)
  • PARI
    a(n)=local(r, p, pr, j); p=prime(n); r=vector(eulerphi(p-1)); pr=znprimroot(p); for(i=1, p-1, if(gcd(i, p-1)==1, r[j++]=lift(pr^i))); vecsum(r) \\ after Franklin T. Adams-Watters's code in A060749, Michel Marcus, Mar 16 2015

A216838 Odd primes for which 2 is not a primitive root.

Original entry on oeis.org

7, 17, 23, 31, 41, 43, 47, 71, 73, 79, 89, 97, 103, 109, 113, 127, 137, 151, 157, 167, 191, 193, 199, 223, 229, 233, 239, 241, 251, 257, 263, 271, 277, 281, 283, 307, 311, 313, 331, 337, 353, 359, 367, 383, 397, 401, 409, 431, 433, 439, 449, 457, 463, 479
Offset: 1

Views

Author

V. Raman, Sep 17 2012

Keywords

Comments

Alternately, for these primes p, the polynomial (x^p+1)/(x+1) is reducible over GF(2).
The prime p belongs to this sequence if and only if A002326((p-1)/2) != (p-1). If A002326((p-1)/2) = (p-1), then the prime p belongs to the sequence A001122. - V. Raman, Dec 01 2012
The only primitive root modulo 2 is 1. See A060749. Hence 2 should be added to this sequence in order to obtain the complement of A001122. - Wolfdieter Lang, May 19 2014

Crossrefs

Cf. A002326 (multiplicative order of 2 mod 2n+1)
Cf. A001122 (Primes for which 2 is a primitive root)
Cf. A115586 (Primes for which 2 is neither a primitive root nor a quadratic residue).

Programs

  • Maple
    select(t -> isprime(t) and numtheory[order](2,t) <> t-1, [seq](2*i+1,i=1..1000)); # Robert Israel, May 20 2014
  • Mathematica
    Select[Prime[Range[2, 100]], PrimitiveRoot[#] =!= 2 &] (* T. D. Noe, Sep 19 2012 *)
  • PARI
    forprime(p=3, 1000, if(znorder(Mod(2,p))!=p-1, print(p)))
    
  • PARI
    forprime(p=3, 1000, if(factormod((x^p+1)/(x+1), 2, 1)[1, 1]!=(p-1), print(p)))

Extensions

Name corrected by Wolfdieter Lang, May 19 2014

A143548 Irregular triangle of numbers k < p^2 such that p^2 divides k^(p-1)-1, with p=prime(n).

Original entry on oeis.org

1, 1, 8, 1, 7, 18, 24, 1, 18, 19, 30, 31, 48, 1, 3, 9, 27, 40, 81, 94, 112, 118, 120, 1, 19, 22, 23, 70, 80, 89, 99, 146, 147, 150, 168, 1, 38, 40, 65, 75, 110, 131, 134, 155, 158, 179, 214, 224, 249, 251, 288, 1, 28, 54, 62, 68, 69, 99, 116, 127, 234, 245, 262, 292, 293, 299, 307, 333, 360
Offset: 1

Views

Author

T. D. Noe, Aug 24 2008

Keywords

Comments

Row n begins with 1 and has prime(n)-1 terms. The first differences of each row are symmetric. For k > p^2, the solutions are just shifted by m*p^2 for m > 0. An open question is whether every integer appears in this sequence. For instance, 2 does not appear until the prime 1093 and 5 does not appear until the prime 20771.
For row n > 1, the sum of the terms in row n is (p-1)*p^2*(p+1)/2, which is A138416. - T. D. Noe, Aug 24 2008, corrected by Robert Israel, Sep 27 2016
Max Alekseyev points out that there is a much faster method of computing these numbers. Let p=prime(n) and let r be a primitive root of p (see A001918 and A060749). Then the terms in row n are r^(k*p) (mod p^2) for k=0..p-2. - T. D. Noe, Aug 26 2008
The numbers in this sequence are the bases to Euler pseudoprimes q, which are squares of prime numbers, such that n^((q-1)/2) == +-1 mod q. An exception is the first number 9 = 3*3, which is, following the strict definition in Crandall and Pomerance, no Fermat pseudoprime and hence no Euler pseudoprime. - Karsten Meyer, Jan 08 2011
For row n > 1, the sum is zero modulo p^2 (rows are antisymmetric due to Binomial Theorem). - Peter A. Lawrence, Sep 11 2016

Examples

			(2)   1,
(3)   1, 8,
(5)   1, 7, 18, 24,
(7)   1, 18, 19, 30, 31, 48,
(11)  1, 3, 9, 27, 40, 81, 94, 112, 118, 120,
(13)  1, 19, 22, 23, 70, 80, 89, 99, 146, 147, 150, 168,
(17)  1, 38, 40, 65, 75, 110, 131, 134, 155, 158, 179, 214, 224, 249, 251, 288,
		

References

  • R. Crandall and C. Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2005

Crossrefs

Programs

  • Maple
    f:= proc(n) local p,j,x;
      p:= ithprime(n);
      x:= numtheory:-primroot(p);
      op(sort([seq(x^(i*p) mod p^2, i=0..p-2)]))
    end proc:
    map(f, [$1..20]); # Robert Israel, Sep 27 2016
  • Mathematica
    Flatten[Table[p=Prime[n]; Select[Range[p^2], PowerMod[ #,p-1,p^2]==1&], {n,50}]] (* T. D. Noe, Aug 24 2008 *)
    Flatten[Table[p=Prime[n]; r=PrimitiveRoot[p]; b=PowerMod[r,p,p^2]; Sort[NestList[Mod[b*#,p^2]&,1,p-2]], {n,50}]] (* Faster version from T. D. Noe, Aug 26 2008 *)

A071894 Largest positive primitive root (

Original entry on oeis.org

1, 2, 3, 5, 8, 11, 14, 15, 21, 27, 24, 35, 35, 34, 45, 51, 56, 59, 63, 69, 68, 77, 80, 86, 92, 99, 101, 104, 103, 110, 118, 128, 134, 135, 147, 146, 152, 159, 165, 171, 176, 179, 189, 188, 195, 197, 207, 214, 224, 223, 230, 237, 234, 248, 254, 261, 267, 269, 272
Offset: 1

Views

Author

N. J. A. Sloane, Jun 11 2002

Keywords

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. 864.
  • R. Osborn, Tables of All Primitive Roots of Odd Primes Less Than 1000, Univ. Texas Press, 1961.

Crossrefs

A diagonal of triangle in A060749.
Cf. A000040, A001918 (least positive primitive root), A002199.

Programs

  • Mathematica
    f[n_] := Block[{k = Prime[n] - 1, p = Prime[n], t = Table[i, {i, 1, Prime[n] - 1}]}, While[ Union[ PowerMod[ k, t, p]] != t, k-- ]; k]; Table[ f[n], {n, 1, 60}]
  • PARI
    a(n) = my(p=prime(n)); forstep(q=p-1, 1, -1, if(znorder(Mod(q, p))==eulerphi(p), return(q))); \\ Michel Marcus, Sep 28 2023

Formula

a(n) = prime(n) - A002199(n) - T. D. Noe, Oct 24 2005

Extensions

More terms from Robert G. Wilson v, Jun 11 2002

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

A123475 Product of the primitive roots of prime(n).

Original entry on oeis.org

1, 2, 6, 15, 672, 924, 11642400, 163800, 109681110000, 5590307923200, 970377408, 134088514560000, 138960660963091968000, 874927557504000, 3456156426256013065185600000000, 30688148115024695887527936000000
Offset: 1

Views

Author

T. D. Noe, Sep 27 2006

Keywords

Comments

Except for n=2, we have a(n)=1 (mod prime(n)).

Examples

			a(5)=672 because the primitive roots of 11 are {2,6,7,8}.
		

References

  • C. F. Gauss, Disquisitiones Arithmeticae, Yale, 1965; see p. 52.

Crossrefs

Cf. A060749 (primitive roots of prime(n)), A088144 (sum of primitive roots of prime(n)).

Programs

  • Mathematica
    PrimRoots[p_] := Select[Range[p-1], MultiplicativeOrder[ #,p]==p-1&]; Table[Times@@PrimRoots[Prime[n]], {n,20}]
    Times@@@Table[PrimitiveRootList[Prime[n]], {n, 20}] (* Harlan J. Brothers, Sep 02 2023 *)
  • PARI
    vecprod(v)=prod(i=1,#v,v[i])
    a(n,p=prime(n))=vecprod(select(n->znorder(Mod(n,p))==p-1,[2..p-1]))
    apply(p->a(0,p), primes(20)) \\ Charles R Greathouse IV, May 15 2015
    
  • Perl
    use ntheory ":all"; sub list { my $n=shift; grep { znorder($,$n) == $n-1 } 2..$n-1; } say vecprod(list($)) for @{primes(nth_prime(20))}; # Dana Jacobsen, May 15 2015

A138305 Irregular triangle of prime primitive roots of prime(n).

Original entry on oeis.org

2, 2, 3, 3, 5, 2, 7, 2, 7, 11, 3, 5, 7, 11, 2, 3, 13, 5, 7, 11, 17, 19, 2, 3, 11, 19, 3, 11, 13, 17, 2, 5, 13, 17, 19, 7, 11, 13, 17, 19, 29, 3, 5, 19, 29, 5, 11, 13, 19, 23, 29, 31, 41, 43, 2, 3, 5, 19, 31, 41, 2, 11, 13, 23, 31, 37, 43, 47, 2, 7, 17, 31, 43, 59, 2, 7, 11, 13, 31, 41, 61, 7
Offset: 2

Views

Author

T. D. Noe, Mar 14 2008

Keywords

Comments

The length of row n is A138304(n).

Examples

			2;
2,3;
3,5;
2,7;
2,7,11;
3,5,7,11;
		

Crossrefs

Cf. A002233 (least prime primitive root), A060749 (triangle of primitive roots of primes).

Programs

  • Mathematica
    Flatten[Table[p=Prime[n]; Select[Prime[Range[n-1]], MultiplicativeOrder[ #,p]==p-1&], {n,100}]]

A002199 Least negative primitive root of n-th prime.

Original entry on oeis.org

1, 1, 2, 2, 3, 2, 3, 4, 2, 2, 7, 2, 6, 9, 2, 2, 3, 2, 4, 2, 5, 2, 3, 3, 5, 2, 2, 3, 6, 3, 9, 3, 3, 4, 2, 5, 5, 4, 2, 2, 3, 2, 2, 5, 2, 2, 4, 9, 3, 6, 3, 2, 7, 3, 3, 2, 2, 2, 5, 3, 6, 2, 7, 2, 10, 2, 5, 10, 3, 2, 3, 2, 2, 2, 4, 2, 2, 5, 3, 21, 3, 2, 5, 5, 5, 3, 3, 13, 2, 2, 3, 2, 2, 4, 5, 2, 2, 3, 4, 2, 4, 2, 3
Offset: 1

Views

Author

Keywords

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. 864.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    Table[(k=-1;While[MultiplicativeOrder[k,p]!=p-1,k--];-k),{p,Prime@Range@100}] (* Giorgos Kalogeropoulos, Sep 28 2023 *)

Formula

a(n) = prime(n) - A071894(n). - T. D. Noe, Oct 24 2005

A266987 Primes p for which the average of the primitive roots equals p/2.

Original entry on oeis.org

2, 5, 13, 17, 19, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 307, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

From Robert Israel, Feb 01 2016: (Start)
Union of A002144 and A267010.
Contains A002144 because for each of these primes, x is a primitive root iff p-x is a primitive root. (End)

Examples

			a(13) = 13 since the primitive roots of 13 are 2, 6, 7, and 11 and the average of these primitive roots is (2+6+7+11)/phi(12) = 26/4 = 13/2.
		

Crossrefs

Programs

  • Maple
    proots := proc(n)
        local r,eulphi,m;
        if n = 1 then
            return {0} ;
        end if;
        eulphi := numtheory[phi](n) ;
        r := {} ;
        for m from 0 to n-1 do
            if numtheory[order](m,n) = eulphi then
                r := r union {m} ;
            end if;
        end do:
        return r;
    end proc:
    isA266987 := proc(n)
        local r;
        if isprime(n) then
            r := convert(proots(n),list) ;
            2*add(pr, pr=r)  = n*nops(r) ;
        else
            false;
        end if;
    end proc:
    for n from 1 to 500 do
        if isA266987(n) then
            printf("%d,",n);
        end if;
    end do: # R. J. Mathar, Jan 12 2016
    Filter:= proc(p) local x, s,js;
      if p mod 4 = 1 then return true fi;
      x:= numtheory:-primroot(p);
      js:= select(t -> igcd(t,p-1)=1, [$1..p-2]);
      s:= add(x&^ j mod p, j=js);
      evalb(s = p/2 * nops(js))
    end proc:
    select(Filter, [seq(ithprime(i),i=1..1000)]); # Robert Israel, Feb 01 2016
  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}],Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1, 100}]; Prime[Flatten[Position[A, _?(# == 1 &)]]]
    (* second program (version >= 10): *)
    Select[Prime[Range[100]], Mean[PrimitiveRootList[#]] == #/2&] (* Jean-François Alcover, Jan 12 2016 *)

Formula

a(n) = prime(A266986(n)).
Showing 1-10 of 35 results. Next