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.
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
Keywords
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.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
- Andrew Granville and Greg Martin, Prime number races, Amer. Math. Monthly, 113 (No. 1, 2006), 1-33.
- Wikipedia, Chebyshev's bias.
Crossrefs
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).
Comments