login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A135267
Difference between partial sum of the first n primes and the first n even numbers greater than 0.
1
0, -1, -2, -3, -2, -1, 2, 5, 10, 19, 28, 41, 56, 71, 88, 109, 134, 159, 188, 219, 250, 285, 322, 363, 410, 459, 508, 559, 610, 663, 728, 795, 866, 937, 1016, 1095, 1178, 1265, 1354, 1447, 1544, 1641, 1746, 1851, 1958, 2065, 2182, 2309, 2438, 2567, 2698, 2833, 2968, 3111, 3258, 3409, 3564, 3719, 3878, 4039, 4200
OFFSET
1,3
LINKS
FORMULA
a(n) = A007504(n) - A002378(n). - R. J. Mathar, Sep 10 2016
MATHEMATICA
Table[Sum[Prime[k], {k, 1, n}] - n*(n + 1), {n, 1, 50}] (* G. C. Greubel, Oct 08 2016 *)
With[{nn=70}, #[[1]]-#[[2]]&/@Thread[{Accumulate[Prime[Range[ nn]]], Accumulate[ Range[2, 2nn, 2]]}]] (* Harvey P. Dale, Aug 20 2017 *)
PROG
(PARI) g(n) = for(x=1, n, y=sum(j=1, x, 2*j); z=sum(j=1, x, prime(j)); print1(z-y", "))
(PARI) a(n)=my(s, k); forprime(p=2, , if(k++>n, break); s+=p); s-n*(n+1) \\ Charles R Greathouse IV, Oct 08 2016
CROSSREFS
Sequence in context: A049063 A120894 A134819 * A242406 A373355 A270469
KEYWORD
sign,easy
AUTHOR
Cino Hilliard, Dec 02 2007
STATUS
approved