login
A237589
Sum of first n odd noncomposite numbers.
3
1, 4, 9, 16, 27, 40, 57, 76, 99, 128, 159, 196, 237, 280, 327, 380, 439, 500, 567, 638, 711, 790, 873, 962, 1059, 1160, 1263, 1370, 1479, 1592, 1719, 1850, 1987, 2126, 2275, 2426, 2583, 2746, 2913, 3086, 3265, 3446, 3637, 3830, 4027, 4226, 4437, 4660, 4887
OFFSET
1,2
COMMENTS
Partial sums of A006005.
FORMULA
a(n) = A007504(n) - 1 = A014284(n+1) - 2.
EXAMPLE
For n = 5 the first five odd noncomposite numbers are 1, 3, 5, 7, 11, so a(5) = 1 + 3 + 5 + 7 + 11 = 27.
MAPLE
a := proc(n) option remember; `if`(n=1, 1, a(n-1) + ithprime(n)) end:
seq(a(n), n=1..49); # Peter Luschny, Sep 20 2018
MATHEMATICA
a[1]=1; a[n_]:=a[n]=a[n-1]+Prime[n]; Table[a[n], {n, 1, 49}] (* Robert P. P. McKone, Jan 18 2022 *)
PROG
(PARI) terms(n) = my(s=1, i=0); forprime(p=3, , if(i >= n, break, print1(s, ", "); i++; s=s+p))
/* Print initial 50 terms as follows */
terms(50) \\ Felix Fröhlich, Sep 20 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Omar E. Pol, Feb 21 2014
STATUS
approved