OFFSET
1,1
COMMENTS
Rosser & Schoenfeld prove Robert Mandl's conjecture that a(n) > 0 for n > 8. - Charles R Greathouse IV, Jun 11 2015
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
J. Barkley Rosser and Lowell Schoenfeld, Sharper bounds for the Chebyshev functions θ(x) and Ψ(x), Mathematics of Computation 29 (1975), pp. 243-269.
Nilotpal Kanti Sinha, On the asymptotic expansion of the sum of the first n primes, arXiv:1011.1667 [math.NT], 2010-2015.
FORMULA
a(n) ~ n^2 / 2. - Charles R Greathouse IV, Jun 11 2015
EXAMPLE
For n = 3, the third prime is 5 and the sum of the first 3 primes is 10, so a(3) = -5
MAPLE
N:= 1000; # to use the primes up to N
Primes:= select(isprime, [$1..N]);
CPrimes:= Statistics:-CumulativeSum(Primes):
A240568:= [seq(round(n*Primes[n] - 2*CPrimes[n]), n=1..nops(Primes))]; # Robert Israel, Apr 08 2014
MATHEMATICA
a[n_] := a[n] = a[n-1] + (n-2) Prime[n] - (n-1) Prime[n-1]; a[1] = -2;
Array[a, 50] (* Jean-François Alcover, Sep 18 2018 *)
PROG
(PARI) a(n)=my(q=prime(n), s); forprime(p=2, q, s+=p); q*n-2*s \\ Charles R Greathouse IV, Jun 11 2015
CROSSREFS
KEYWORD
sign
AUTHOR
Robert Israel, Apr 08 2014
STATUS
approved
