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.

A070218 a(1) = 2; a(n) is the smallest prime greater than the sum of all previous terms.

Original entry on oeis.org

2, 3, 7, 13, 29, 59, 127, 241, 487, 971, 1949, 3889, 7789, 15569, 31139, 62297, 124577, 249181, 498331, 996689, 1993357, 3986711, 7973419, 15946841, 31893713, 63787391, 127574789, 255149591, 510299171, 1020598339, 2041196683, 4082393387, 8164786771, 16329573527
Offset: 1

Views

Author

Amarnath Murthy, May 01 2002

Keywords

Comments

Grows exponentially: ceiling(log_2(a(n))) = n. - Labos Elemer, May 08 2002

Crossrefs

Programs

  • Maple
    s:= proc(n) option remember; `if`(n<1, 0, s(n-1)+a(n)) end:
    a:= proc(n) option remember; `if`(n<1, 0, nextprime(s(n-1))) end:
    seq(a(n), n=1..35);  # Alois P. Heinz, Sep 21 2021
  • Mathematica
    tb[0]={} tb[x_] := Union[tb[x-1], m[x]] m[x_] := {Prime[1+PrimePi[Apply[Plus, tb[x-1]]]]} Flatten[Table[m[w], {w, 1, 10}]] (* Labos Elemer, May 08 2002 *)
    bb={2};s=2;Do[p=Prime[PrimePi[s]+1];s=s+p;bb=Append[bb, p], {k, 32}];bb (Seidov)
    Nest[Append[#,NextPrime[Total[#]]]&,{2},30] (* Zak Seidov, Oct 28 2011 *)
  • PARI
    print1(s=2);for(n=2,99,print1(", "t=nextprime(s+1));s+=t)
    
  • Python
    from sympy import nextprime
    def aupton(terms):
        alst, s = [2], 2
        while len(alst) < terms:
            p = nextprime(s)
            alst.append(p)
            s += p
        return alst
    print(aupton(31)) # Michael S. Branicky, Sep 21 2021

Extensions

More terms from Labos Elemer, May 08 2002
Corrected by Zak Seidov, May 21 2005