login
a(0) = 0, a(n+1) = a(n) + next prime larger than a(n).
3

%I #24 Apr 25 2022 08:04:08

%S 0,2,5,12,25,54,113,240,481,968,1939,3888,7777,15566,31135,62274,

%T 124571,249148,498329,996660,1993349,3986706,7973417,15946836,

%U 31893677,63787390,127574781,255149570,510299161,1020598332,2041196671,4082393354,8164786741,16329573512

%N a(0) = 0, a(n+1) = a(n) + next prime larger than a(n).

%H Alois P. Heinz, <a href="/A063807/b063807.txt">Table of n, a(n) for n = 0..2500</a> (first 201 terms from Harry J. Smith)

%e 0 + 2 = 2, 2 + 3 = 5, 5 + 7 = 12, 12 + 13 = 25, 25 + 29 = 54, ...

%p a:= proc(n) option remember; `if`(n=0, 0, (t->

%p t+nextprime(t))(a(n-1)))

%p end:

%p seq(a(n), n=0..35); # _Alois P. Heinz_, Sep 21 2021

%t Join[{0}, NestList[# + NextPrime[#] &, 2, 50]] (* Updated by _Jean-François Alcover_, Apr 25 2022 for a(0)=0 *)

%o (PARI) s(n)=if(n<1,n=0,s(n-1)+nextprime(s(n-1)+1)); for(n=0,21,print(s(n)))

%o (PARI) { for (n=0, 200, if (n, a+=nextprime(a + 1), a=0); write("b063807.txt", n, " ", a) ) } \\ _Harry J. Smith_, Aug 31 2009

%Y Cf. A070218, A151800.

%K nonn

%O 0,2

%A Pedro Ortiz-Villajos (perico1(AT)erols.com), Aug 20 2001

%E More terms from _Harvey P. Dale_ and _Jason Earls_, Aug 20 2001