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

A007350 Where the prime race 4k-1 vs. 4k+1 changes leader.

Original entry on oeis.org

3, 26861, 26879, 616841, 617039, 617269, 617471, 617521, 617587, 617689, 617723, 622813, 623387, 623401, 623851, 623933, 624031, 624097, 624191, 624241, 624259, 626929, 626963, 627353, 627391, 627449, 627511, 627733, 627919, 628013, 628427, 628937, 629371
Offset: 1

Views

Author

Keywords

Comments

The following references include some on the "prime race" question that are not necessarily related to this particular sequence. - N. J. A. Sloane, May 22 2006
Starting from a(12502) = A051025(27556) = 9103362505801, the sequence includes the 8th sign-changing zone predicted by C. Bays et al. The sequence with the first 8 sign-changing zones contains 194367 terms (see a-file) with a(194367) = 9543313015387 as its last term. - Sergei D. Shchebetov, Oct 13 2017

References

  • Ford, Kevin; Konyagin, Sergei; Chebyshev's conjecture and the prime number race. IV International Conference "Modern Problems of Number Theory and its Applications": Current Problems, Part II (Russian) (Tula, 2001), 67-91.
  • Granville, Andrew; Martin, Greg; Prime number races. (Spanish) With appendices by Giuliana Davidoff and Michael Guy. Gac. R. Soc. Mat. Esp. 8 (2005), no. 1, 197-240.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A156749 [sequence showing Chebyshev bias in prime races (mod 4)]. - Daniel Forgues, Mar 26 2009

Programs

  • Mathematica
    lim = 10^5; k1 = 0; k3 = 0; t = Table[{p = Prime[k], If[Mod[p, 4] == 1, ++k1, k1], If[Mod[p, 4] == 3, ++k3, k3]}, {k, 2, lim}]; A007350 = {3}; Do[ If[t[[k-1, 2]] < t[[k-1, 3]] && t[[k, 2]] == t[[k, 3]] && t[[k+1, 2]] > t[[k+1, 3]] || t[[k-1, 2]] > t[[k-1, 3]] && t[[k, 2]] == t[[k, 3]] && t[[k+1, 2]] < t[[k+1, 3]], AppendTo[A007350, t[[k+1, 1]]]], {k, 2, Length[t]-1}]; A007350 (* Jean-François Alcover, Sep 07 2011 *)
    lim = 10^5; k1 = 0; k3 = 0; p = 2; t = {}; parity = Mod[p, 4]; Do[p = NextPrime[p]; If[Mod[p, 4] == 1, k1++, k3++]; If[(k1 - k3)*(parity - Mod[p, 4]) > 0, AppendTo[t, p]; parity = Mod[p, 4]], {lim}]; t (* T. D. Noe, Sep 07 2011 *)

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

A038691 Indices of primes at which the prime race 4k-1 vs. 4k+1 is tied.

Original entry on oeis.org

1, 3, 7, 13, 89, 2943, 2945, 2947, 2949, 2951, 2953, 50371, 50375, 50377, 50379, 50381, 50393, 50413, 50423, 50425, 50427, 50429, 50431, 50433, 50435, 50437, 50439, 50445, 50449, 50451, 50503, 50507, 50515, 50517, 50821, 50843, 50853, 50855, 50857, 50859, 50861
Offset: 1

Views

Author

Keywords

Comments

Starting from a(27410) = 316064952537 the sequence includes the 8th sign-changing zone predicted by C. Bays et al back in 2001. The sequence with the first 8 sign-changing zones contains 419467 terms (see a-file) with a(419467) = 330797040309 as its last term. - Sergei D. Shchebetov, Oct 16 2017

Examples

			From _Jon E. Schoenfield_, Jul 24 2021: (Start)
a(n) is the n-th number m at which the prime race 4k-1 vs. 4k+1 is tied:
.
                             count
                           ----------
   m  p=prime(m)  p mod 4  4k-1  4k+1
  --  ----------  -------  ----  ----
   1       2         2       0  =  0    a(1)=1
   2       3        -1       1     0
   3       5        +1       1  =  1    a(2)=3
   4       7        -1       2     1
   5      11        -1       3     1
   6      13        +1       3     2
   7      17        +1       3  =  3    a(3)=7
   8      19        -1       4     3
   9      23        -1       5     3
  10      29        +1       5     4
  11      31        -1       6     4
  12      37        +1       6     5
  13      41        +1       6  =  6    a(4)=13
(End)
		

References

  • Stan Wagon, The Power of Visualization, Front Range Press, 1994, pp. 2-3.

Crossrefs

Cf. A156749; sequence showing Chebyshev bias in prime races (mod 4). - Daniel Forgues, Mar 26 2009

Programs

  • Mathematica
    Flatten[ Position[ FoldList[ Plus, 0, Mod[ Prime[ Range[ 2, 50900 ] ], 4 ]-2 ], 0 ] ]
  • PARI
    lista(nn) = {nbp = 0; nbm = 0; forprime(p=2, nn, if (((p-1) % 4) == 0, nbp++, if (((p+1) % 4) == 0, nbm++)); if (nbm == nbp, print1(primepi(p), ", ")););} \\ Michel Marcus, Nov 20 2016

A112632 Excess of 3k - 1 primes over 3k + 1 primes, beginning with 2.

Original entry on oeis.org

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

Views

Author

Roger Hui, Dec 22 2005

Keywords

Comments

Cumulative sums of A134323, negated. The first negative term is a(23338590792) = -1 for the prime 608981813029. See page 4 of the paper by Granville and Martin. - T. D. Noe, Jan 23 2008 [Corrected by Jianing Song, Nov 24 2018]
See the comment about "Chebyshev's bias" in A321856. - Jianing Song, Nov 24 2018

Examples

			a(1) = 1 because 2 == -1 (mod 3).
a(2) = 1 because 3 == 0 (mod 3) and does not change the counting.
a(3) = 2 because 5 == -1 (mod 3).
a(4) = 1 because 7 == 1 (mod 3).
		

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), 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), this sequence (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • Haskell
    a112632 n = a112632_list !! (n-1)
    a112632_list = scanl1 (+) $ map negate a134323_list
    -- Reinhard Zumkeller, Sep 16 2014
    
  • Mathematica
    a[n_] := a[n] = a[n-1] + If[Mod[Prime[n], 6] == 1, -1, 1]; a[1] = a[2] = 1; Table[a[n], {n, 1, 100}]  (* Jean-François Alcover, Jul 24 2012 *)
    Accumulate[Which[IntegerQ[(#+1)/3],1,IntegerQ[(#-1)/3],-1,True,0]& /@ Prime[ Range[100]]] (* Harvey P. Dale, Jun 06 2013 *)
  • PARI
    a(n) = -sum(i=1, n, kronecker(-3, prime(i))) \\ Jianing Song, Nov 24 2018

Formula

a(n) = -Sum_{primes p<=n} Legendre(prime(i),3) = -Sum_{primes p<=n} Kronecker(-3,prime(i)) = -Sum_{i=1..n} A102283(prime(i)). - Jianing Song, Nov 24 2018

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).
Showing 1-10 of 30 results. Next