|
|
A163057
|
|
An alternating sum from the n-th odd number up to the n-th odd prime.
|
|
2
|
|
|
2, 4, 6, 9, 11, 14, 16, 19, 23, 25, 29, 32, 34, 37, 41, 45, 47, 51, 54, 56, 60, 63, 67, 72, 75, 77, 80, 82, 85, 93, 96, 100, 102, 108, 110, 114, 118, 121, 125, 129, 131, 137, 139, 142, 144, 151, 158, 161, 163, 166, 170, 172, 178, 182, 186, 190, 192, 196, 199, 201, 207, 215
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
|
A130472 := proc(n) (-1)^n*floor((n+1)/2) ; end:
A065091 :=proc(n) ithprime(n+1) ; end:
|
|
MATHEMATICA
|
1/2 (-1 + 2 # + Prime[# + 1]) & /@ Range[100] (* David Trimas, Jul 21 2024 *)
|
|
PROG
|
(Python)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|