login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A240568 Difference between n times the n-th prime and twice the sum of the first n primes. 1
-2, -4, -5, -6, -1, -4, 3, -2, 7, 32, 21, 50, 57, 40, 49, 86, 123, 96, 137, 142, 109, 156, 161, 210, 305, 304, 253, 254, 201, 204, 497, 490, 545, 472, 663, 582, 641, 700, 685, 746, 807, 708, 937, 830, 809, 700, 1041, 1382, 1347, 1216 (list; graph; refs; listen; history; text; internal format)
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
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 * A000040(n) - 2 * A007504(n).
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
Sequence in context: A116680 A138083 A181524 * A309681 A287224 A077867
KEYWORD
sign
AUTHOR
Robert Israel, Apr 08 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 28 12:16 EDT 2024. Contains 372085 sequences. (Running on oeis4.)