OFFSET
1,2
COMMENTS
Define a 1-based sum S(n) = sum_{i=1..n} (1 - (-1)^i*i) = A014682(n).
a(n) is this sum evaluated for the upper limit prime(n) = A000040(n).
a(n) = prime(n) + (prime(n)+1)/2 for n>1. (E.g., 3 + 4/2 = 5, 5 + 6/2 = 8, 7 + 8/2 = 11, ....) - Vladimir Joseph Stephan Orlovsky, Nov 30 2009 [edited by Jon E. Schoenfield, Feb 10 2015]
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
EXAMPLE
a(1) = 1-1*(-1)^1+1-2*(-1)^2 = 1+1+1-2 = 1.
a(3) = 1-1*(-1)^1+1-2*(-1)^2+1-3*(-1)^3+1-4*(-1)^4+1-5*(-1)^5 = 1+1+1-2+1+3+1-4+1+5 = 8.
MAPLE
A014682 := proc(n) option remember; coeftayl( x*(2+x+x^2)/(1-x^2)^2, x=0, n) ; end:
A162939 := proc(n) A014682(ithprime(n)) ; end: seq(A162939(n), n=1..70) ; # R. J. Mathar, Jul 21 2009
MATHEMATICA
f[n_]:=n/2; lst={}; Do[p=Prime[n]; AppendTo[lst, p+f[p+1]], {n, 2, 5!}]; lst (* Vladimir Joseph Stephan Orlovsky, Nov 30 2009 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Jul 18 2009
EXTENSIONS
Definition edited by R. J. Mathar, Jul 21 2009
STATUS
approved