A034960 Divide odd numbers into groups with prime(n) elements and add together.
4, 21, 75, 189, 495, 897, 1683, 2565, 4071, 6641, 8959, 13209, 17835, 22317, 28623, 37577, 48439, 57401, 71623, 85697, 98623, 118737, 138195, 163493, 196231, 224321, 249775, 281945, 310759, 347249, 420751, 467801, 525943, 571985, 656047
Offset: 1
Keywords
Examples
{1,3} #2 S=4; {5,7,9} #3 S=21; {11,13,15,17,19} #5 S=75; {21,23,25,27,29,31,33} #7 S=189.
Links
- Hieronymus Fischer, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Maple
S:= n-> sum(ithprime(k), k=1..n): seq(S(n+1)^2-S(n)^2, n=0..40); # Gary Detlefs, Dec 20 2011
-
Mathematica
Accumulate[Join[{2}, ListConvolve[{1, 1}, #]]]*# & [Prime[Range[50]]] (* Paolo Xausa, Jun 23 2025 *)
-
PARI
a0(n) = vecsum(primes(n))^2 - vecsum(primes(n-1))^2; \\ Michel Marcus, Jun 16 2024
-
Python
from itertools import islice from sympy import nextprime def A034960_gen(): # generator of terms a, p = 0, 2 while True: yield p*((a<<1)+p) a, p = a+p, nextprime(p) A034960_list = list(islice(A034960_gen(),20)) # Chai Wah Wu, Mar 22 2023