login
A129726
a(n) = a(n-1) + prime(n) - prime(n-1) + 2; a(1) = 2.
1
2, 5, 9, 13, 19, 23, 29, 33, 39, 47, 51, 59, 65, 69, 75, 83, 91, 95, 103, 109, 113, 121, 127, 135, 145, 151, 155, 161, 165, 171, 187, 193, 201, 205, 217, 221, 229, 237, 243, 251, 259, 263, 275, 279, 285, 289, 303, 317, 323, 327
OFFSET
1,1
COMMENTS
The sequence shows 36 primes in the first 100 entries; the largest run of primes in these has length 4.
LINKS
FORMULA
a(n) = a(n-1) + A001223(n-1) + 2.
a(n) = prime(n) + 2*n - 2. - Bill McEachen, Dec 02 2023
MAPLE
A129726:= proc(n) option remember;
if n = 1 then 2;
else procname(n-1)+2+ithprime(n)-ithprime(n-1);
end if; end proc:
seq(A129726(n), n=1..50) ; # R. J. Mathar, Feb 01 2014
MATHEMATICA
a[n_]:= a[n]= If[n==1, 2, a[n-1] +Prime[n] -Prime[n-1] +2]; Table[a[n], {n, 50}]
RecurrenceTable[{a[1]==2, a[n]==a[n-1]+2+Prime[n]-Prime[n-1]}, a, {n, 50}] (* Harvey P. Dale, Apr 02 2018 *)
PROG
(PARI) a(n) = if(n==1, 2, a(n-1) +prime(n) -prime(n-1) +2); \\ G. C. Greubel, Dec 02 2019
(Magma)
function a(n)
if n eq 1 then return 2;
else return a(n-1) + NthPrime(n) - NthPrime(n-1) + 2;
end if; return a; end function;
[a(n): n in [1..50]]; // G. C. Greubel, Dec 02 2019
(Sage)
def a(n):
if (n==1): return 2
else: return a(n-1) + nth_prime(n) - nth_prime(n-1) + 2
[a(n) for n in (1..50)] # G. C. Greubel, Dec 02 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula, May 12 2007
STATUS
approved