A151960 Sum_{x = A141468(n) to A000040(n)} 1-(-1)^x*x.
2, 5, 3, 3, 6, 16, 12, 12, 15, 37, 24, 30, 33, 55, 39, 45, 77, 54, 88, 66, 66, 72, 109, 84, 129, 99, 99, 142, 105, 108, 126, 175, 138, 138, 200, 153, 211, 168, 171, 233, 186, 244, 201, 201, 204, 268, 222, 303, 243, 243, 316, 255, 255, 267, 349, 282
Offset: 1
Keywords
Examples
a(1)=1-0+1+1+1-2=2, a(2)=1+1+1-2+1+3=5, a(3)=1-4+1+5=3, a(4)=1-6+1+7=3, a(5)=1-8+1+9+1-10+1+11=6, a(6)=1+9+1-10+1+11+1-12+1+13=16, a(7)=1-10+1+11+1-12+1+13+1-14+1+15+1-16+1+17=12, a(8)=1-12+1+13+1-14+1+15+1-16+1+17+1-18+1+19=12, a(9)=1-14+1+15+1-16+1+17+1-18+1+19+1-20+1+21+1-22+1+23=15, a(10)=1+15+1-16+1+17+1-18+1+19+1-20+1+21+1-22+1+23+1-24+1+25+1-26+1+27+1-28+1+29=37, ...
Programs
-
Mathematica
ZeroAndNonPrime[n_Integer] := FixedPoint[n - 1 + PrimePi@# &, n - 1 + PrimePi@n]; ZeroAndNonPrime[2] = 1; f[n_] := Sum[1-(-1)^x*x, {x, ZeroAndNonPrime@n, Prime@n}]; Array[f, 56]
Extensions
Edited, corrected and extended by Robert G. Wilson v, Jul 24 2009
Definition clarified by N. J. A. Sloane, Jul 25 2009
Definition corrected by Charles R Greathouse IV, Jul 22 2010