The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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

%I #13 Sep 18 2018 04:15:30

%S -2,-4,-5,-6,-1,-4,3,-2,7,32,21,50,57,40,49,86,123,96,137,142,109,156,

%T 161,210,305,304,253,254,201,204,497,490,545,472,663,582,641,700,685,

%U 746,807,708,937,830,809,700,1041,1382,1347,1216

%N Difference between n times the n-th prime and twice the sum of the first n primes.

%C Rosser & Schoenfeld prove Robert Mandl's conjecture that a(n) > 0 for n > 8. - _Charles R Greathouse IV_, Jun 11 2015

%H Robert Israel, <a href="/A240568/b240568.txt">Table of n, a(n) for n = 1..10000</a>

%H J. Barkley Rosser and Lowell Schoenfeld, <a href="https://doi.org/10.1090/S0025-5718-1975-0457373-7">Sharper bounds for the Chebyshev functions θ(x) and Ψ(x)</a>, Mathematics of Computation 29 (1975), pp. 243-269.

%H Nilotpal Kanti Sinha, <a href="http://arxiv.org/abs/1011.1667">On the asymptotic expansion of the sum of the first n primes</a>, arXiv:1011.1667 [math.NT], 2010-2015.

%F a(n) = n * A000040(n) - 2 * A007504(n).

%F a(n) ~ n^2 / 2. - _Charles R Greathouse IV_, Jun 11 2015

%e For n = 3, the third prime is 5 and the sum of the first 3 primes is 10, so a(3) = -5

%p N:= 1000; # to use the primes up to N

%p Primes:= select(isprime,[$1..N]);

%p CPrimes:= Statistics:-CumulativeSum(Primes):

%p A240568:= [seq(round(n*Primes[n] - 2*CPrimes[n]),n=1..nops(Primes))]; # _Robert Israel_, Apr 08 2014

%t a[n_] := a[n] = a[n-1] + (n-2) Prime[n] - (n-1) Prime[n-1]; a[1] = -2;

%t Array[a, 50] (* _Jean-François Alcover_, Sep 18 2018 *)

%o (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

%Y Cf. A000040, A007504.

%K sign

%O 1,1

%A _Robert Israel_, Apr 08 2014

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 May 12 20:41 EDT 2024. Contains 372494 sequences. (Running on oeis4.)