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

A089451 a(n) = mu(prime(n)-1), where mu is the Moebius function (A008683).

Original entry on oeis.org

1, -1, 0, 1, 1, 0, 0, 0, 1, 0, -1, 0, 0, -1, 1, 0, 1, 0, -1, -1, 0, -1, 1, 0, 0, 0, -1, 1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 1, 0, 0, 1, -1, 0, 0, 1, 0, 0, 0, 0, -1, 0, -1, 0, -1, -1, 0, 0, 0, 1, 1, 1, 0, 0, -1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 0, -1, 0, 0
Offset: 1

Views

Author

T. D. Noe, Nov 03 2003

Keywords

Comments

Note that A049092 lists prime(n) such that a(n) = 0. Similarly, A078330 lists prime(n) such that a(n) = -1. See A088179 for prime(n) such that a(n) = 1. Also note that a(n) == A088144(n) (mod prime(n)).

References

  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 236.

Crossrefs

Cf. A089495 (mu(p+1) for prime p), A089496 (mu(p+1)+mu(p-1) for prime p), A089497 (mu(p+1)-mu(p-1) for prime p).

Programs

  • Magma
    [MoebiusMu(NthPrime(n)-1): n in [1..100]]; // Vincenzo Librandi, Dec 23 2018
  • Mathematica
    Table[MoebiusMu[Prime[n]-1], {n, 150}]
  • PARI
    a(n)=moebius(prime(n)-1)
    

Formula

a(n) = A067460(n) - 1. - Benoit Cloitre, Nov 04 2003
If p = prime(n), then a(n) is congruent modulo p to the sum of all primitive roots modulo p. [Uspensky and Heaslet]. - Michael Somos, Feb 16 2020

A049092 Primes p such that p-1 is not squarefree.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Primes p with mu(p-1)=0, where mu is the Möbius function. - T. D. Noe, Nov 03 2003
Primes p such that the sum of the primitive roots of p (see A088144) is 0 mod p. - Jon Wharf, Mar 12 2015
The relative density of this sequence within the primes is 1 - A005596 = 0.626044... - Amiram Eldar, Feb 10 2021

Examples

			p = 257 is here because p-1 = 256 = 2^8.
p = 997 is here because p-1 = 996 = 3*(2^2)*83.
		

Crossrefs

Cf. A005596, A039787, A078330 (primes p with mu(p-1)=-1), A088179 (primes p such that mu(p-1)=1), A089451 (mu(p-1) for prime p), A145199.

Programs

  • Magma
    [ p: p in PrimesUpTo(500) | not IsSquarefree(p-1) ]; // Vincenzo Librandi, Mar 12 2015
    
  • Mathematica
    Select[Prime[Range[400]], MoebiusMu[ #-1]==0&]
  • PARI
    forprime(p=2,500,if(!issquarefree(p-1),print(p))) \\ Michael B. Porter, Mar 16 2015

Formula

a(n) = A145199(n) + 1. - Amiram Eldar, Feb 10 2021

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

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

A121380 Sums of primitive roots for n (or 0 if n has no primitive roots).

Original entry on oeis.org

0, 1, 2, 3, 5, 5, 8, 0, 7, 10, 23, 0, 26, 8, 0, 0, 68, 16, 57, 0, 0, 56, 139, 0, 100, 52, 75, 0, 174, 0, 123, 0, 0, 136, 0, 0, 222, 114, 0, 0, 328, 0, 257, 0, 0, 208, 612, 0, 300, 200, 0, 0, 636, 156, 0, 0, 0, 348, 886, 0, 488, 216, 0, 0, 0, 0, 669, 0, 0, 0
Offset: 1

Views

Author

Ed Pegg Jr, Jul 25 2006

Keywords

Comments

In Article 81 of his Disquisitiones Arithmeticae (1801), Gauss proves that the sum of all primitive roots (A001918) of a prime p, mod p, equals MoebiusMu[p-1] (A008683). "The sum of all primitive roots is either = 0 (mod p) (when p-1 is divisible by a square), or = +-1 (mod p) (when p-1 is the product of unequal prime numbers; if the number of these is even the sign is positive but if the number is odd, the sign is negative)."

Examples

			The primitive roots of 13 are 2, 6, 7, 11. Their sum is 26, or 0 (mod 13). By Gauss, 13-1=12 is thus divisible by a square number.
		

References

  • J. C. F. Gauss, Disquisitiones Arithmeticae, 1801.

Crossrefs

Cf. A001918, A008683, A046147 (primitive roots of n), A088144, A088145, A123475, A222009.

Programs

  • Mathematica
    primitiveRoots[n_] := If[n == 1, {}, If[n == 2, {1}, Select[Range[2, n-1], MultiplicativeOrder[#, n] == EulerPhi[n] &]]]; Table[Total[primitiveRoots[n]], {n,100}]
    (* From version 10 up: *)
    Table[Total @ PrimitiveRootList[n], {n, 1, 100}] (* Jean-François Alcover, Oct 31 2016 *)

A254309 Irregular triangular array read by rows: T(n,k) is the least positive primitive root of the n-th prime p=prime(n) raised to successive powers of k (mod p) where 1<=k<=p-1 and gcd(k,p-1)=1.

Original entry on oeis.org

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

Views

Author

Geoffrey Critzer, May 03 2015

Keywords

Comments

Each row is a complete set of incongruent primitive roots.
Each row is a permutation of the corresponding row in A060749.
Row lengths are A008330.
T(n,1) = A001918(n).

Examples

			1;
2;
2,  3;
3,  5;
2,  8,  7,  6;
2,  6, 11,  7;
3, 10,  5, 11, 14,  7, 12,  6;
2, 13, 14, 15,  3, 10;
5, 10, 20, 17, 11, 21, 19, 15,  7, 14;
2,  8,  3, 19, 18, 14, 27, 21, 26, 10, 11, 15;
Row 6 contains 2,6,11,7 because 13 is the 6th prime number. 2 is the least positive primitive root of 13. The integers relatively prime to 13-1=12 are {1,5,7,11}. So we have: 2^1==2, 2^5==6, 2^7==11, and 2^11==7 (mod 13).
		

Crossrefs

Last elements of rows give A255367.
Row sums give A088144.

Programs

  • Maple
    with(numtheory):
    T:= n-> (p-> seq(primroot(p)&^k mod p, k=select(
             h-> igcd(h, p-1)=1, [$1..p-1])))(ithprime(n)):
    seq(T(n), n=1..15);  # Alois P. Heinz, May 03 2015
  • Mathematica
    Table[nn = p;Table[Mod[PrimitiveRoot[nn]^k, nn], {k,Select[Range[nn - 1], CoprimeQ[#, nn - 1] &]}], {p,Prime[Range[12]]}] // Grid

A266986 The indices of primes p for which the average of the primitive roots equals p/2.

Original entry on oeis.org

1, 3, 6, 7, 8, 10, 12, 13, 16, 18, 21, 24, 25, 26, 29, 30, 33, 35, 37, 40, 42, 44, 45, 50, 51, 53, 55, 57, 59, 60, 62, 63, 65, 66, 68, 70, 71, 74, 77, 78, 79, 80, 82, 84, 87, 88, 89, 97, 98, 100, 102, 104, 106, 108, 110, 112, 113, 116, 119, 121, 122, 123, 126, 127, 130, 134, 135, 136, 137, 139, 140, 142, 145
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

The average of the primitive roots of a prime p are <,=, or > p/2 (observation).
The indices of all primes p==1(mod 4) are in this sequence since for primes of form 4k+1 b a primitive root implies -b a primitive root.
The indices of some primes p==3 (mod 4) are also in this sequence although for most such primes the average of the primitive roots is <> p/2.(observation)

Examples

			p(a(1))=p(1)=2. 2 has the primitive root 1. The average primitive root is 1 and 1=2/2.
p(a(2))=p(3)=5. The primitive roots of 5 are 2 and 3. Their average equals (2+3)/phi(4)=5/2=p/2.
		

Crossrefs

Programs

  • 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, 1000}]; Flatten[Position[A, _?(# == 1 &)]]

A266989 Primes for which the average of the primitive roots is < p/2.

Original entry on oeis.org

31, 43, 67, 223, 379, 491, 619, 631, 643, 683, 859, 883, 907, 1051, 1091, 1423, 1747, 1987, 2143, 2347, 2371, 2467, 2531, 2767, 3307, 3643, 3691, 3739, 3823, 3931, 4019, 4219, 4519, 4691, 4987, 5059, 5107, 5347, 5683, 5827, 6043
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

These primes are congruent to 3 (mod 4).

Examples

			a(1)=31. The primitive roots of 31 are 3, 11, 12, 13, 17, 21, 22, and 24.
Their average is (3+11+12+13+17+21+22+24)/phi(30)=123/8<31/2.
		

Crossrefs

Programs

  • Maple
    f:= proc(p) local g;
      if not isprime(p) then return false fi;
      g:= numtheory[primroot](p);
      evalb(add(g&^i mod p, i = select(t->igcd(t,p-1)=1, [$1..p-2]))
         < p/2 * numtheory:-phi(p-1))
    end proc:
    select(f, [seq(i,i=3..10000,4)]); # Robert Israel, Feb 09 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 &)]]]
  • PARI
    ar(p) = my(r, pr, j); r=vector(eulerphi(p-1)); pr=znprimroot(p); for(i=1, p-1, if(gcd(i, p-1)==1, r[j++]=lift(pr^i))); vecsort(r) ;
    isok(p) = my(vr = ar(p)); vecsum(vr)/#vr < p/2;
    lista(nn) = forprime(p=2, nn, if (isok(p), print1(p, ", "))); \\ Michel Marcus, Feb 09 2016

Formula

a(n) = prime(A266988(n)).

A266990 The indices of primes p for which the average of the primitive roots is > p/2.

Original entry on oeis.org

2, 4, 5, 9, 15, 17, 20, 22, 23, 27, 28, 31, 32, 34, 36, 38, 39, 41, 43, 46, 47, 49, 52, 54, 56, 58, 61, 64, 67, 69, 72, 73, 76, 81, 83, 85, 86, 90, 91, 92, 93, 95, 96, 99, 101, 103, 105, 107, 109, 111, 118, 120, 125, 128, 129, 131, 132, 133, 138, 141, 143, 144, 146, 150
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

It appears that these primes are all congruent to 3 (mod 4).

Examples

			a(2) = 4 is a term since prime(a(2)) = prime(4) = 7, the primitive roots of 7 are 3 and 5 and their average is (3+5)/2 = 8/2 > 7/2.
		

Crossrefs

Programs

  • 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, 1000}]; Flatten[Position[A, _?(# > 1 &)]]
    Select[Range[150], Mean[PrimitiveRootList[(p = Prime[#])]] > p/2 &] (* Amiram Eldar, Oct 09 2021 *)

Formula

a(n) = A000720(A267009(n)). - Amiram Eldar, Oct 09 2021

A267009 Primes p for which the average of the primitive roots is > p/2.

Original entry on oeis.org

3, 7, 11, 23, 47, 59, 71, 79, 83, 103, 107, 127, 131, 139, 151, 163, 167, 179, 191, 199, 211, 227, 239, 251, 263, 271, 283, 311, 331, 347, 359, 367, 383, 419, 431, 439, 443, 463, 467, 479, 487, 499, 503, 523, 547, 563, 571, 587, 599, 607, 647, 659, 691, 719, 727
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

It appears that these primes are all congruent to 3 (mod 4).

Examples

			a(2) = 7 since the primitive roots of 7 are 3 and 5 and their average is (3+5)/2 = 8/2 > 7/2.
		

Crossrefs

Programs

  • 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, 1000}]; Prime[Flatten[Position[A, _?(# > 1 &)]]]
    Select[Range[1000], PrimeQ[#] && Mean[PrimitiveRootList[#]] > #/2 &] (* Amiram Eldar, Oct 09 2021 *)

Formula

a(n) = prime(A266990(n)).
Showing 1-10 of 12 results. Next