A161570 Sum of all numbers from n up to A018252(n).
1, 9, 18, 30, 35, 40, 57, 77, 84, 91, 116, 144, 153, 162, 195, 205, 215, 225, 235, 275, 318, 330, 342, 354, 366, 416, 429, 442, 497, 555, 570, 585, 648, 664, 680, 696, 712, 782, 799, 816, 833, 850, 927, 1007, 1026, 1045, 1064, 1083, 1170, 1190, 1210, 1302
Offset: 1
Examples
a(2) = 2 + 3 + 4 = 9; a(3) = 3 + 4 + 5 + 6 = 18; a(4) = 4 + 5 + 6 + 7 + 8 = 30.
Programs
-
Maple
A018252 := proc(n) option remember ; if n = 1 then 1; else for a from procname(n-1)+1 do if not isprime(a) then RETURN(a) ; fi; od: fi; end: A000217 := proc(n) n*(n+1)/2 ; end: A161570 := proc(n) A000217( A018252(n)) - A000217(n-1) ; end: seq(A161570(n),n=1..90) ; # R. J. Mathar, Aug 03 2009
-
PARI
print1(n=1);p=3;forprime(q=5,97,for(k=p+1,q-1,print1(", "k*(k+1)/2-n++*(n-1)/2));p=q) \\ Charles R Greathouse IV, Sep 03 2011
Extensions
a(26) corrected and extended by R. J. Mathar, Aug 03 2009
Definition rephrased by R. J. Mathar, Sep 11 2009