OFFSET
1,1
EXAMPLE
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, ...
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]
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Jul 14 2009
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
STATUS
approved