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 41 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

A007351 Where prime race 4m-1 vs. 4m+1 is tied.

Original entry on oeis.org

2, 5, 17, 41, 461, 26833, 26849, 26863, 26881, 26893, 26921, 616769, 616793, 616829, 616843, 616871, 617027, 617257, 617363, 617387, 617411, 617447, 617467, 617473, 617509, 617531, 617579, 617681, 617707, 617719, 618437, 618521, 618593, 618637
Offset: 1

Views

Author

Keywords

Comments

Primes p such that the number of primes <= p of the form 4m-1 is equal to the number of primes <= p of the form 4m+1.
Starting from a(27410)=9103362505753 the sequence includes the 8th sign-changing zone predicted by C. Bays et al. The sequence with the first 8 sign-changing zones contains 419467 terms (see a-file) with a(419467)=9543313015351 as its last term. - Sergei D. Shchebetov, Oct 15 2017

References

  • 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). [From Daniel Forgues, Mar 26 2009]

Programs

  • Mathematica
    Prime@ Position[Fold[Append[#1, #1[[-1]] + If[Mod[#2, 4] == 3, {1, 0}, {0, 1}]] &, {{0, 0}}, Prime@ Range[2, 10^5]], ?(SameQ @@ # &)][[All, 1]] (* _Michael De Vlieger, May 27 2018 *)
  • PARI
    lista(nn) = {nb = 0; forprime(p=2, nn, m = (p % 4); if (m == 1, nb++, if (m == 3, nb--)); if (!nb, print1(p, ", ")););} \\ Michel Marcus, Oct 05 2017
    
  • Python
    from sympy import nextprime; a, p = 0, 2; R = [p]
    while p < 618637:
        p=nextprime(p); a += p%4-2
        if a == 0: R.append(p)
    print(*R, sep = ', ')  # Ya-Ping Lu, Jan 18 2025

Extensions

Corrected and extended by Enoch Haga, Feb 24 2004

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

A007352 Where the prime race 3k-1 vs. 3k+1 changes leader.

Original entry on oeis.org

2, 608981813029, 608981813507, 608981813683, 608981813819, 608981814127, 608981814143, 608981818999, 608981820977, 608981826877, 608981826977, 608981827873, 608981828201, 608981836363, 608981836493, 608981836681, 608981836973, 608981836993, 608981837063
Offset: 1

Views

Author

Keywords

Comments

Terms a(2n+1) form a subsequence of A098044.

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence, although the terms are incorrect - see A185703).

Crossrefs

Extensions

Terms from a(3) onwards corrected by Max Alekseyev, Feb 10 2011

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

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

A051024 Values of n for which pi_{4,3}(p_n) - pi_{4,1}(p_n) = -1, where p_n is the n-th prime and pi_{m,a}(x) is the number of primes <= x which are congruent to a (mod m).

Original entry on oeis.org

2946, 50378, 50380, 50382, 50392, 50414, 50418, 50420, 50422, 50424, 50426, 50428, 50430, 50436, 50438, 50446, 50448, 50450, 50822, 50832, 50834, 50842, 50844, 50852, 50854, 50856, 50858, 50862, 50864, 50866, 50872, 50892, 50902
Offset: 1

Views

Author

Keywords

Comments

This is a companion sequence to A051025.
Starting from a(27556) = 316064952540 the sequence includes the 8th sign-changing zone predicted by C. Bays et al. The sequence with the first 8 sign-changing zones contains 418933 terms (see a-file) with a(418933) = 330797040308 as its last term. - Sergei D. Shchebetov, Oct 06 2017
We also discovered the 9th sign-changing zone, which starts from 2083576475506, ends with 2083615410040, and has 13370 terms with pi_{4,3}(p) - pi_{4,1}(p) = -1. This zone is considerably lower than predicted by M. Deléglise et al. in 2004. - Andrey S. Shchebetov and Sergei D. Shchebetov, Dec 30 2017
We also discovered the 10th sign-changing zone, which starts from 21576098946648, ends with 22056324317296, and has 481194 terms with pi_{4,3}(p) - pi_{4,1}(p) = -1. This zone is considerably lower than predicted by M. Deléglise et al. in 2004. - Andrey S. Shchebetov and Sergei D. Shchebetov, Jan 28 2018

Crossrefs

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

Programs

  • Mathematica
    For[i=2; d=0, True, i++, d+=Mod[Prime[i], 4]-2; If[d==-1, Print[i]]]
    (* Second program: *)
    Position[Accumulate@ Array[Mod[Prime@ #, 4] - 2 &, 51000], -1][[All, 1]] (* Michael De Vlieger, Dec 30 2017 *)
  • Python
    from sympy import nextprime; a, p = 0, 2
    for n in range(2, 50917):
        p=nextprime(p); a += p%4-2
        if a == -1: print(n, end = ', ') # Ya-Ping Lu, Jan 18 2025

Extensions

Edited by Dean Hickerson, Mar 05 2002

A321858 a(n) = Pi(12,5)(n) + Pi(12,7)(n) - Pi(12,1)(n) - Pi(12,11)(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, 0, 0, 1, 1, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Jianing Song, Nov 20 2018

Keywords

Comments

a(n) is the number of odd primes <= n that have 3 as a quadratic nonresidue minus the number of primes <= n that have 3 as a quadratic residue.
The first 10000 terms are nonnegative. a(p) = 0 for primes p = 2, 3, 13, 433, 443, 457, 479, 491, 503, 3541, ... The earliest negative term is a(61463) = -1. Conjecturally infinitely many terms should be 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 19 2023]
Here, although 11 is not a quadratic residue modulo 12, for most n we have Pi(12,7)(n) + Pi(12,11)(n) > Pi(12,1)(n) - Pi(12,5)(n), Pi(12,5)(n) + Pi(12,11)(n) > Pi(12,1)(n) + Pi(12,7)(n) and Pi(12,5)(n) + Pi(12,7)(n) > Pi(12,1)(n) + Pi(12,11)(n).

Examples

			Pi(12,1)(100) = 5, Pi(12,5)(100) = Pi(12,7)(100) = Pi(12,11)(100) = 6, so a(100) = 6 + 6 - 5 - 6 = 1.
		

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), this sequence (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(12, i))

Formula

a(n) = -Sum_{primes p<=n} Kronecker(12,p) = -Sum_{primes p<=n} A110161(p).

A321861 a(n) = A071838(prime(n)).

Original entry on oeis.org

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

Views

Author

Jianing Song, Nov 20 2018

Keywords

Comments

a(n) is positive for 2 <= n <= 10000, but conjecturally infinitely many terms should be negative.
The first negative term occurs at a(732722) = -1. - Jianing Song, Nov 08 2019
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 19 2023].
Here, although 7 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

			prime(25) = 97, Pi(8,1)(97) = 5, Pi(8,3)(97) = 7, Pi(8,5)(97) = Pi(8,7)(97) = 6, so a(25) = 7 + 6 - 5 - 6 = 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), 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), this sequence (d=8), A321863 (d=12).

Programs

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

Extensions

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