OFFSET
1,1
COMMENTS
Define the alternating sum S(n) = -Sum_{j=0..n} (-1)^j*j = -A130472(n).
Then a(n) = S(n-th odd prime) - S((n-th odd number) - 1), as if the sum were ranging over all j from the n-th odd number up to the n-th odd prime.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
a(1) = 1 - 2 + 3 = 2;
a(2) = 3 - 4 + 5 = 4;
a(3) = 5 - 6 + 7 = 6;
a(4) = 7 - 8 + 9 - 10 + 11 = 9;
a(5) = 9 - 10 + 11 - 12 + 13 = 11;
a(6) = 11 - 12 + 13 - 14 + 15 - 16 + 17 = 14.
MAPLE
MATHEMATICA
1/2 (-1 + 2 # + Prime[# + 1]) & /@ Range[100] (* David Trimas, Jul 21 2024 *)
PROG
(Python)
from sympy import sieve as A000040
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Juri-Stepan Gerasimov, Jul 20 2009
EXTENSIONS
Rephrased in terms of A130472 by R. J. Mathar, Jul 27 2009
STATUS
approved