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
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
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