

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.


13



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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,17


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.
In general, assuming the strong form of RH, 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 n, 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".


LINKS

Table of n, a(n) for n=1..87.
Wikipedia, Chebyshev's bias


FORMULA

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


EXAMPLE

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.


PROG

(PARI) a(n) = sum(i=1, n, isprime(i)*kronecker(7, i))


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).
Sequence in context: A231717 A253315 A210480 * A321860 A266123 A115230
Adjacent sequences: A321856 A321857 A321858 * A321860 A321861 A321862


KEYWORD

sign


AUTHOR

Jianing Song, Nov 20 2018


STATUS

approved



