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 A034956 #35 Apr 25 2024 09:09:36 %S A034956 3,12,40,98,253,455,850,1292,2047,3335,4495,6623,8938,11180,14335, %T A034956 18815,24249,28731,35845,42884,49348,59408,69139,81791,98164,112211, %U A034956 124939,141026,155434,173681,210439,233966,263040,286062,328098,355152,393442,434558,472777 %N A034956 Divide natural numbers in groups with prime(n) elements and add together. %C A034956 Natural numbers starting from 1,2,3,4,... %H A034956 Hieronymus Fischer, <a href="/A034956/b034956.txt">Table of n, a(n) for n = 1..1000</a> %F A034956 From _Hieronymus Fischer_, Sep 27 2012: (Start) %F A034956 a(n) = Sum_{k=A007504(n-1)+1..A007504(n)} k, n > 1. %F A034956 a(n) = (A007504(n) - A007504(n-1))*(A007504(n) + A007504(n-1) + 1)/2, n > 1. %F A034956 a(n) = (A000217(A007504(n)) - A000217(A007504(n-1))), n > 0. %F A034956 If we define A007504(0) := 0, then the formulas above are also true for n=1. %F A034956 a(n) = (A034960(n) + A000040(n))/2. %F A034956 a(n) = A034957(n) + A000040(n). (End) %e A034956 {1,2} #2 S=3; %e A034956 {3,4,5} #3 S=12; %e A034956 {6,7,8,9,10} #5 S=40; %e A034956 {11,12,13,14,15,16,17} #7 S=98. %p A034956 s:= proc(n) s(n):= `if`(n<1, 0, s(n-1)+ithprime(n)) end: %p A034956 a:= n-> (t-> t(s(n))-t(s(n-1)))(i-> i*(i+1)/2): %p A034956 seq(a(n), n=1..40); # _Alois P. Heinz_, Mar 22 2023 %t A034956 Module[{nn=50,pr},pr=Prime[Range[nn]];Total/@TakeList[Range[ Total[ pr]], pr]](* Requires Mathematica version 11 or later *) (* _Harvey P. Dale_, Oct 01 2017 *) %o A034956 (Python) %o A034956 from itertools import islice %o A034956 from sympy import nextprime %o A034956 def A034956_gen(): # generator of terms %o A034956 a, p = 0, 2 %o A034956 while True: %o A034956 yield p*((a<<1)+p+1)>>1 %o A034956 a, p = a+p, nextprime(p) %o A034956 A034956_list = list(islice(A034956_gen(),20)) # _Chai Wah Wu_, Mar 22 2023 %Y A034956 Cf. A006003, A027441, A034957. %Y A034956 Cf. A046992, A034958, A034959, A034960. %Y A034956 Cf. A000040, A000217, A007504. %K A034956 nonn %O A034956 1,1 %A A034956 _Patrick De Geest_, Oct 15 1998