OFFSET
1,3
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
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
A. Granville and G. Martin, Prime number races, Amer. Math. Monthly, 113 (No. 1, 2006), pp. 1-33.
Wikipedia, Chebyshev's bias
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
EXAMPLE
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).
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 *)
PROG
(Haskell)
a112632 n = a112632_list !! (n-1)
a112632_list = scanl1 (+) $ map negate a134323_list
-- Reinhard Zumkeller, Sep 16 2014
(PARI) a(n) = -sum(i=1, n, kronecker(-3, prime(i))) \\ Jianing Song, Nov 24 2018
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).
KEYWORD
sign,nice
AUTHOR
Roger Hui, Dec 22 2005
STATUS
approved