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

A038698 Excess of 4k-1 primes over 4k+1 primes, beginning with prime 2.

Original entry on oeis.org

0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 2, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 3, 2, 3, 2, 3, 4, 3, 4, 3, 4, 3, 2, 3, 4, 5, 6, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 3, 4, 3, 4, 5, 4, 3, 4, 3, 4, 3, 2, 3, 4, 3, 4, 5, 4, 3, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 6, 5, 6, 5, 6, 5, 6
Offset: 1

Views

Author

Keywords

Comments

a(n) < 0 for infinitely many values of n. - Benoit Cloitre, Jun 24 2002
First negative value is a(2946) = -1, which is for prime 26861. - David W. Wilson, Sep 27 2002

References

  • Stan Wagon, The Power of Visualization, Front Range Press, 1994, p. 2.

Crossrefs

Cf. A112632 (race of 3k-1 and 3k+1 primes), A216057, A269364.
Cf. A156749 (sequence showing Chebyshev bias in prime races (mod 4)), A199547, A267097, A267098, A267107, A292378.
List of primes p such that a(p) = 0 is A007351. List of primes p such that a(p) < 0 is A199547. List of primes p such that a(p) = -1 is A051025. List of integers k such that a(prime(k)) = -1 is A051024. - Ya-Ping Lu, Jan 18 2025

Programs

  • Maple
    ans:=[0]; ct:=0; for n from 2 to 2000 do
    p:=ithprime(n); if (p mod 4) = 3 then ct:=ct+1; else ct:=ct-1; fi;
    ans:=[op(ans),ct]; od: ans; # N. J. A. Sloane, Jun 24 2016
  • Mathematica
    FoldList[Plus, 0, Mod[Prime[Range[2,110]], 4] - 2]
    Join[{0},Accumulate[If[Mod[#,4]==3,1,-1]&/@Prime[Range[2,110]]]] (* Harvey P. Dale, Apr 27 2013 *)
  • PARI
    for(n=2,100,print1(sum(i=2,n,(-1)^((prime(i)+1)/2)),","))
    
  • Python
    from sympy import nextprime; a, p = 0, 2; R = [a]
    for _ in range(2,88): p=nextprime(p); a += p%4-2; R.append(a)
    print(*R, sep = ', ')  # Ya-Ping Lu, Jan 18 2025

Formula

a(n) = Sum_{k=2..n} (-1)^((prime(k)+1)/2). - Benoit Cloitre, Jun 24 2002
a(n) = (Sum_{k=1..n} prime(k) mod 4) - 2*n (assuming that x mod 4 > 0). - Thomas Ordowski, Sep 21 2012
From Antti Karttunen, Oct 01 2017: (Start)
a(n) = A267098(n) - A267097(n).
a(n) = A292378(A000040(n)).
(End)
From Ridouane Oudra, Nov 04 2024: (Start)
a(n) = Sum_{k=2..n} i^(prime(k)+1), where i is the imaginary unit.
a(n) = Sum_{k=2..n} sin(3*prime(k)*Pi/2).
a(n) = Sum_{k=2..n} A163805(prime(k)).
a(n) = Sum_{k=2..n} A212159(k). (End)
a(n) = a(n-1) + prime(n) (mod 4) - 2, n >= 2. - Ya-Ping Lu, Jan 18 2025

A066520 Number of primes of the form 4m+3 <= n minus number of primes of the form 4m+1 <= n.

Original entry on oeis.org

0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 2
Offset: 1

Views

Author

Sharon Sela (sharonsela(AT)hotmail.com), Jan 05 2002

Keywords

Comments

Although the initial terms are nonnegative, it has been proved that infinitely many terms are negative. The first two are a(26861)=a(26862)=-1. Next there are 3404 values of n in the range 616841 to 633798 with a(n)<0. Then 27218 values in the range 12306137 to 12382326.
Partial sums of A151763. - Reinhard Zumkeller, Feb 06 2014

Crossrefs

Cf. A156749 Sequence showing Chebyshev bias in prime races (mod 4). [From Daniel Forgues, Mar 26 2009]
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), A321859 (d=-7), this sequence (d=-4), A321856 (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • Haskell
    a066520 n = a066520_list !! (n-1)
    a066520_list = scanl1 (+) $ map (negate . a151763) [1..]
    -- Reinhard Zumkeller, Feb 06 2014
  • Mathematica
    a[n_] := Length[Select[Range[3, n, 4], PrimeQ]]-Length[Select[Range[1, n, 4], PrimeQ]]
    f[n_]:=Module[{c=Mod[n,4]},Which[!PrimeQ[n],0,c==3,1,c==1,-1]]; Join[{0,0}, Accumulate[Array[f,110,3]]] (* Harvey P. Dale, Mar 03 2013 *)

Formula

a(n) = A066490(n) - A066339(n).
a(2*n+1) = a(2*n+2) = -A156749(n). - Jonathan Sondow, May 17 2013

Extensions

Edited by Dean Hickerson, Mar 05 2002

A321856 Number of primes of the form 3*m + 2 <= n minus number of primes of the form 3*m + 1 <= n.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Jianing Song, Nov 20 2018

Keywords

Comments

a(n) is the number of primes <= n that are quadratic nonresidues modulo 3 minus the number of primes <= n that are quadratic residues modulo 3.
Conjecturally infinitely many terms are negative. The earliest negative term is a(608981813029) = -1, see A112632.
In general, assuming the strong form of the Riemann Hypothesis, if 0 < a, b < k are integers, gcd(a, k) = gcd(b, k) = 1, a is a quadratic residue and b is a quadratic nonresidue mod k, then Pi(k,b)(n) > Pi(k,a)(n) occurs more often than not. Pi(a,b)(x) denotes the number of primes in the arithmetic progression a*k + b less than or equal to x. This phenomenon is called "Chebyshev's bias". (See Wikipedia link and especially the links in A007350.) [Edited by Peter Munn, Nov 05 2023]

Examples

			Below 100, there are 11 primes congruent to 1 modulo 3 and 13 primes congruent to 2 modulo 3, so a(100) = 13 - 11 = 2.
		

Crossrefs

Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), A321859 (d=-7), A066520 (d=-4), this sequence (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • PARI
    a(n) = -sum(i=1, n, isprime(i)*kronecker(-3, i))

Formula

a(n) = -Sum_{primes p<=n} Legendre(p,3) = -Sum_{primes p<=n} Kronecker(-3,p) = -Sum_{primes p<=n} A102283(p).
a(n) = A340764(n) - A340763(n). - Jianing Song, May 06 2021

A071838 a(n) = Pi(8,3)(n) + Pi(8,5)(n) - Pi(8,1)(n) - Pi(8,7)(n) where Pi(a,b)(x) denotes the number of primes in the arithmetic progression a*k + b less than or equal to x.

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 2, 2, 2
Offset: 1

Views

Author

Benoit Cloitre, Jun 08 2002

Keywords

Comments

a(n) is the number of odd primes <= n that have 2 as a quadratic nonresidue minus the number of primes <= n that have 2 as a quadratic residue. See the comments about "Chebyshev's bias" in A321861. - Jianing Song, Nov 24 2018
Although the initial terms are nonnegative, infinitely many terms should be negative. For which n does a(n) = -1?
The first negative term occurs at a(11100143) = -1. - Jianing Song, Nov 08 2019

Crossrefs

Cf. A091337.
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), A321859 (d=-7), A066520 (d=-4), A321856 (d=-3), A321857 (d=5), this sequence (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • Mathematica
    Accumulate@ Array[-If[PrimeQ@ #, KroneckerSymbol[2, #], 0] &, 105] (* Michael De Vlieger, Nov 25 2018 *)
  • PARI
    for(n=1,200,print1(sum(i=1,n,if((i*isprime(i)-3)%8,0,1)+if((i*isprime(i)-5)%8,0,1)-if((i*isprime(i)-1)%8,0,1)-if((i*isprime(i)-7)%8,0,1)),", ")) \\ Program fixed by Jianing Song, Nov 08 2019
    
  • PARI
    a(n) = -sum(i=1, n, isprime(i)*kronecker(2, i)) \\ Jianing Song, Nov 24 2018

Formula

a(n) = -Sum_{primes p<=n} Kronecker(2,p) = -Sum_{primes p<=n} A091337(p). - Jianing Song, Nov 20 2018

Extensions

Edited by Peter Munn, Nov 19 2023

A320857 a(n) = Pi(8,5)(n) + Pi(8,7)(n) - Pi(8,1)(n) - Pi(8,3)(n) where Pi(a,b)(x) denotes the number of primes in the arithmetic progression a*k + b less than or equal to x.

Original entry on oeis.org

0, 0, -1, -1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Jianing Song, Nov 24 2018

Keywords

Comments

a(n) is the number of odd primes <= n that have -2 as a quadratic nonresidue minus the number of primes <= n that have -2 as a quadratic residue.
It seems that there are more negative terms here than in some other sequences mentioned in crossrefs; nevertheless, among the first 10000 terms, only 212 ones are negative.
In general, assuming the strong form of the Riemann Hypothesis, if 0 < a, b < k are integers, gcd(a, k) = gcd(b, k) = 1, a is a quadratic residue and b is a quadratic nonresidue mod k, then Pi(k,b)(n) > Pi(k,a)(n) occurs more often than not. This phenomenon is called "Chebyshev's bias". (See Wikipedia link and especially the links in A007350.) [Edited by Peter Munn, Nov 18 2023]
Here, although 3 is not a quadratic residue modulo 8, for most n we have Pi(8,5)(n) + Pi(8,7)(n) > Pi(8,1)(n) - Pi(8,3)(n), Pi(8,3)(n) + Pi(8,7)(n) > Pi(8,1)(n) + Pi(8,5)(n) and Pi(8,5)(n) + Pi(8,7)(n) > Pi(8,1)(n) + Pi(8,7)(n).

Examples

			Pi(8,1)(200) = 8, Pi(8,5)(200) = 13, Pi(8,3)(200) = Pi(8,7)(200) = 12, so a(200) = 13 + 12 - 8 - 12 = 5.
		

Crossrefs

Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), this sequence (d=-8), A321859 (d=-7), A066520 (d=-4), A321856 (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • Mathematica
    Accumulate@ Array[-If[PrimeQ@ #, KroneckerSymbol[-2, #], 0] &, 88] (* Michael De Vlieger, Nov 25 2018 *)
  • PARI
    a(n) = -sum(i=1, n, isprime(i)*kronecker(-2, i))
    
  • Python
    from sympy import isprime; from numpy import sign
    def A320857(n): return sum(isprime(i)*(i%2)*sign(i%8-4) for i in range(1,n+1)) # Ya-Ping Lu, Jan 25 2025

Formula

a(n) = -Sum_{primes p<=n} Kronecker(-2,p) = -Sum_{primes p<=n} A188510(p).

A320858 a(n) = A320857(prime(n)).

Original entry on oeis.org

0, -1, 0, 1, 0, 1, 0, -1, 0, 1, 2, 3, 2, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 1, 0, 1, 2, 1, 2, 1, 2, 1, 0, -1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 4, 5, 4, 5, 4, 3, 2, 3, 4, 5, 6, 5, 4, 5, 4, 5, 4, 5, 4, 3, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 5, 4, 5, 6, 5, 6, 5, 4
Offset: 1

Views

Author

Jianing Song, Nov 24 2018

Keywords

Comments

Among the first 10000 terms there are only 100 negative ones. See the comments about "Chebyshev's bias" in A320857.

Examples

			prime(46) = 199, Pi(8,1)(199) = 8, Pi(8,5)(199) = 13, Pi(8,3)(199) = Pi(8,7)(199) = 12, so a(46) = 13 + 12 - 8 - 12 = 5.
		

Crossrefs

Cf. A188510.
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), A321859 (d=-7), A066520 (d=-4), A321856 (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), this sequence (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • Mathematica
    a[n_] := -Sum[KroneckerSymbol[-2, Prime[i]], {i, 1, n}];
    Array[a, 100] (* Jean-François Alcover, Dec 28 2018, from PARI *)
  • PARI
    a(n) = -sum(i=1, n, kronecker(-2, prime(i)))

Formula

a(n) = -Sum_{i=1..n} Kronecker(prime(i),2) = -Sum_{primes p<=n} Kronecker(2,prime(i)) = -Sum_{i=1..n} A091337(prime(i)).

A321857 a(n) = Pi(5,2)(n) + Pi(5,3)(n) - Pi(5,1)(n) - Pi(5,4)(n) where Pi(a,b)(x) denotes the number of primes in the arithmetic progression a*k + b less than or equal to x.

Original entry on oeis.org

0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4
Offset: 1

Views

Author

Jianing Song, Nov 20 2018

Keywords

Comments

a(n) is the number of primes <= n that are quadratic nonresidues modulo 5 minus the number of primes <= n that are quadratic residues modulo 5.
a(n) is positive for 2 <= n <= 10000, but conjecturally infinitely many terms should be negative.
The first negative term occurs at a(2082927221) = -1. - Jianing Song, Nov 08 2019
Please see the comment in A321856 describing "Chebyshev's bias" in the general case.

Examples

			Pi(5,1)(100) = Pi(5,4)(100) = 5, Pi(5,2)(100) = Pi(5,3)(100) = 7, so a(100) = 7 + 7 - 5 - 5 = 4.
		

Crossrefs

Cf. A080891.
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), A321859 (d=-7), A066520 (d=-4), A321856 (d=-3), this sequence (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • PARI
    a(n) = -sum(i=1, n, isprime(i)*kronecker(5, i))

Formula

a(n) = -Sum_{primes p<=n} Legendre(p,5) = -Sum_{primes p<=n} Kronecker(5,p) = -Sum_{primes p<=n} A080891(p).

Extensions

Edited by Peter Munn, Nov 18 2023

A321859 Number of primes congruent to 3, 5, 6 modulo 7 and <= n minus number of primes congruent to 1, 2, 4 modulo 7 and <= n.

Original entry on oeis.org

0, -1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Jianing Song, Nov 20 2018

Keywords

Comments

a(n) is the number of primes <= n that are quadratic nonresidues modulo 7 minus the number of primes <= n that are quadratic residues modulo 7.
The first 10000 terms (except for a(2)) are nonnegative. a(p) = 0 for primes p = 3, 11, 211, 3371, 3389, ... The earliest negative term (besides a(2)) is a(48673) = -1. Conjecturally infinitely many terms should be negative.
Please see the comment in A321856 describing "Chebyshev's bias" in the general case.

Examples

			Below 100, there are 10 primes congruent to 1, 2, 4 modulo 7 and 14 primes congruent to 3, 5, 6 modulo 7, so a(100) = 14 - 10 = 4.
		

Crossrefs

Cf. A175629.
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), this sequence (d=-7), A066520 (d=-4), A321856 (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • Mathematica
    Accumulate[Table[Which[PrimeQ[n]&&MemberQ[{3,5,6},Mod[n,7]],1,PrimeQ[ n] && MemberQ[ {1,2,4},Mod[ n,7]],-1,True,0],{n,90}]] (* Harvey P. Dale, Apr 28 2022 *)
  • PARI
    a(n) = -sum(i=1, n, isprime(i)*kronecker(-7, i))

Formula

a(n) = -Sum_{primes p<=n} Legendre(p,7) = -Sum_{primes p<=n} Kronecker(-7,p) = -Sum_{primes p<=n} A175629(p).

A321860 Number of primes congruent to 2, 6, 7, 8, 10 modulo 11 and <= n minus number of primes congruent to 1, 3, 4, 5, 9 modulo 11 and <= n.

Original entry on oeis.org

0, 1, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Jianing Song, Nov 20 2018

Keywords

Comments

a(n) is the number of primes <= n that are quadratic nonresidues modulo 11 minus the number of primes <= n that are quadratic residues modulo 11.
It seems that there are more negative terms here than in some other sequences mentioned in crossrefs; nevertheless, among the first 10000 terms, only 138 ones are negative.
Please see the comment in A321856 describing "Chebyshev's bias" in the general case.

Examples

			Below 200, there are 20 primes congruent to 1, 3, 4, 5, 9 modulo 11 and 23 primes congruent to 2, 6, 7, 8, 10 modulo 11, so a(200) = 23 - 20 = 3.
		

Crossrefs

Cf. A112632.
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: this sequence (d=-11), A320857 (d=-8), A321859 (d=-7), A066520 (d=-4), A321856 (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • PARI
    a(n) = -sum(i=1, n, isprime(i)*kronecker(-11, i))

Formula

a(n) = -Sum_{primes p<=n} Legendre(p,11) = -Sum_{primes p<=n} Kronecker(-11,p) = -Sum_{primes p<=n} A011582(p).

A321862 a(n) = A321857(prime(n)).

Original entry on oeis.org

1, 2, 2, 3, 2, 3, 4, 3, 4, 3, 2, 3, 2, 3, 4, 5, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 5, 4, 3, 4, 5, 6, 7, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 6, 5, 4, 3, 4, 5, 4, 3, 4, 3, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 7, 8, 9, 8, 9, 8, 9, 8, 7, 6, 5, 4, 5, 4, 5, 4
Offset: 1

Views

Author

Jianing Song, Nov 20 2018

Keywords

Comments

The first 10000 terms are positive, but conjecturally infinitely many terms should be negative.
The first negative term occurs at a(102091236) = -1. - Jianing Song, Nov 08 2019
Please see the comment in A321856 describing "Chebyshev's bias" in the general case.

Examples

			prime(25) = 97, Pi(5,1)(97) = Pi(5,4)(97) = 5, Pi(5,2)(97) = Pi(5,3)(97) = 7, so a(25) = 7 + 7 - 5 - 5 = 4.
		

Crossrefs

Cf. A080891.
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), A321859 (d=-7), A066520 (d=-4), A321856 (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), this sequence (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • PARI
    a(n) = -sum(i=1, n, kronecker(5, prime(i)))

Formula

a(n) = -Sum_{i=1..n} Legendre(prime(i),5) = -Sum_{primes p<=n} Kronecker(2,prime(i)) = -Sum_{i=1..n} A080891(prime(i)).

Extensions

Edited by Peter Munn, Nov 19 2023
Showing 1-10 of 22 results. Next