|
|
A034956
|
|
Divide natural numbers in groups with prime(n) elements and add together.
|
|
9
|
|
|
3, 12, 40, 98, 253, 455, 850, 1292, 2047, 3335, 4495, 6623, 8938, 11180, 14335, 18815, 24249, 28731, 35845, 42884, 49348, 59408, 69139, 81791, 98164, 112211, 124939, 141026, 155434, 173681, 210439, 233966, 263040, 286062, 328098, 355152, 393442, 434558, 472777
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Natural numbers starting from 1,2,3,4,...
|
|
LINKS
|
|
|
FORMULA
|
If we define A007504(0) := 0, then the formulas above are also true for n=1.
|
|
EXAMPLE
|
{1,2} #2 S=3;
{3,4,5} #3 S=12;
{6,7,8,9,10} #5 S=40;
{11,12,13,14,15,16,17} #7 S=98.
|
|
MAPLE
|
s:= proc(n) s(n):= `if`(n<1, 0, s(n-1)+ithprime(n)) end:
a:= n-> (t-> t(s(n))-t(s(n-1)))(i-> i*(i+1)/2):
|
|
MATHEMATICA
|
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 *)
|
|
PROG
|
(Python)
from itertools import islice
from sympy import nextprime
def A034956_gen(): # generator of terms
a, p = 0, 2
while True:
yield p*((a<<1)+p+1)>>1
a, p = a+p, nextprime(p)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,changed
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|