A034957 Divide natural numbers in groups with prime(n) elements and add together.
1, 9, 35, 91, 242, 442, 833, 1273, 2024, 3306, 4464, 6586, 8897, 11137, 14288, 18762, 24190, 28670, 35778, 42813, 49275, 59329, 69056, 81702, 98067, 112110, 124836, 140919, 155325, 173568, 210312, 233835, 262903, 285923, 327949, 355001, 393285
Offset: 1
Keywords
Examples
{0,1} #2 S=1; {2,3,4} #3 S=9; {5,6,7,8,9} #5 S=35; {10,11,12,13,14,15,16} #7 S=91.
Links
- Hieronymus Fischer, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
{1}~Join~Map[Abs@ Apply[Subtract, Map[PolygonalNumber, #]] &, Partition[Accumulate@ Prime@ Range@ 37 - 1, 2, 1]] (* Michael De Vlieger, Oct 06 2019 *) Module[{nn=40,tprs},tprs=Total[Prime[Range[nn]]];Total/@TakeList[Range[0,tprs],Prime[Range[nn]]]] (* Harvey P. Dale, Apr 18 2025 *)
-
Python
from itertools import islice from sympy import nextprime def A034957_gen(): # generator of terms a, p = 0, 2 while True: yield p*((a<<1)+p-1)>>1 a, p = a+p, nextprime(p) A034957_list = list(islice(A034957_gen(),20)) # Chai Wah Wu, Mar 22 2023
Formula
From Hieronymus Fischer, Sep 27 2012: (Start)
If we define A007504(0):=0, then the formulas above are also true for n=1.
a(n) = A034959(n)/2.
(End)
Comments