cp's OEIS Frontend

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.

A237589 Sum of first n odd noncomposite numbers.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Feb 21 2014

Keywords

Comments

Partial sums of A006005.

Examples

			For n = 5 the first five odd noncomposite numbers are 1, 3, 5, 7, 11, so a(5) = 1 + 3 + 5 + 7 + 11 = 27.
		

Crossrefs

Programs

  • 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 *)
  • 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

Formula

a(n) = A007504(n) - 1 = A014284(n+1) - 2.