|
|
A106738
|
|
Difference between the sums of odd-indexed primes and even-indexed primes up to and including index 10^n.
|
|
1
|
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
a(n) = Sum2 - Sum1, where Sum1 = prime(1) + prime(3) + ... + prime(10^n-1), and Sum2 = prime(2) + prime(4) + ... + prime(10^n).
|
|
MAPLE
|
A106738 := proc(n) local a, i ; a :=0 ; for i from 1 to 10^n do a := a+(-1)^i*ithprime(i) ; od: RETURN(a) ; end: for n from 1 do print(A106738(n)) ; od: # R. J. Mathar, Feb 13 2008
|
|
MATHEMATICA
|
a[n_] := Module[{a = 0}, For[i = 1, i <= 10^n, i++, a = a + (-1)^i*Prime[i]]; a]; Table[Print[an = a[n]]; an, {n, 1, 8}] (* Jean-François Alcover, Dec 17 2012, after R. J. Mathar *)
|
|
PROG
|
(PARI) lista(pmax) = {my(pow = 10, k = 0, s = 0); forprime(p = 1, pmax, k++; s += ((-1)^k * p); if(k == pow, print1(s, ", "); pow *= 10)); } \\ Amiram Eldar, Jul 02 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|