This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A034957 #35 Apr 18 2025 14:43:04 %S A034957 1,9,35,91,242,442,833,1273,2024,3306,4464,6586,8897,11137,14288, %T A034957 18762,24190,28670,35778,42813,49275,59329,69056,81702,98067,112110, %U A034957 124836,140919,155325,173568,210312,233835,262903,285923,327949,355001,393285 %N A034957 Divide natural numbers in groups with prime(n) elements and add together. %C A034957 Natural numbers starting from 0,1,2,3,... %H A034957 Hieronymus Fischer, <a href="/A034957/b034957.txt">Table of n, a(n) for n = 1..1000</a> %F A034957 From _Hieronymus Fischer_, Sep 27 2012: (Start) %F A034957 a(n) = Sum_{k=A007504(n-1)+1..A007504(n)} (k-1), n > 1. %F A034957 a(n) = (A007504(n) - A007504(n-1))*(A007504(n) + A007504(n-1) - 1)/2, n > 1. %F A034957 a(n) = (A000217(A007504(n) - 1) - A000217(A007504(n-1) - 1)), n > 1. %F A034957 If we define A007504(0):=0, then the formulas above are also true for n=1. %F A034957 a(n) = A034959(n)/2. %F A034957 a(n) = A034956(n) - A000040(n). %F A034957 (End) %e A034957 {0,1} #2 S=1; %e A034957 {2,3,4} #3 S=9; %e A034957 {5,6,7,8,9} #5 S=35; %e A034957 {10,11,12,13,14,15,16} #7 S=91. %t A034957 {1}~Join~Map[Abs@ Apply[Subtract, Map[PolygonalNumber, #]] &, Partition[Accumulate@ Prime@ Range@ 37 - 1, 2, 1]] (* _Michael De Vlieger_, Oct 06 2019 *) %t A034957 Module[{nn=40,tprs},tprs=Total[Prime[Range[nn]]];Total/@TakeList[Range[0,tprs],Prime[Range[nn]]]] (* _Harvey P. Dale_, Apr 18 2025 *) %o A034957 (Python) %o A034957 from itertools import islice %o A034957 from sympy import nextprime %o A034957 def A034957_gen(): # generator of terms %o A034957 a, p = 0, 2 %o A034957 while True: %o A034957 yield p*((a<<1)+p-1)>>1 %o A034957 a, p = a+p, nextprime(p) %o A034957 A034957_list = list(islice(A034957_gen(),20)) # _Chai Wah Wu_, Mar 22 2023 %Y A034957 Cf. A006003, A027441, A034956. %Y A034957 Cf. A046992, A034958, A034959, A034960. %K A034957 nonn %O A034957 1,2 %A A034957 _Patrick De Geest_, Oct 15 1998