OFFSET
1,3
LINKS
Lucas A. Brown, Python program.
MATHEMATICA
FoldList[(Prime[#2+#1]-Prime[#2])&, 1, Range@15] (* Ivan N. Ianakiev, Aug 23 2015 *)
RecurrenceTable[{a[n+1] == Prime[n+a[n]] - Prime[n], a[1]==1}, a, {n, 1, 16}] (* G. C. Greubel, Aug 24 2015 *)
nxt[{n_, a_}]:={n+1, Prime[n+a]-Prime[n]}; NestList[nxt, {1, 1}, 16][[All, 2]] (* Harvey P. Dale, May 15 2018 *)
PROG
(Haskell)
a261518 n = a261518_list !! (n - 1)
a261518_list = 1 : zipWith (-)
(map a000040 (zipWith (+) a261518_list [1..])) a000040_list
(Magma) [1] cat [n le 1 select 1 else NthPrime(n + Self(n-1)) - NthPrime(n): n in [1..12]]; // Vincenzo Librandi, Aug 24 2015
(PARI) a(n) = if(n==1, 1, prime(n-1 + a(n-1)) - prime(n-1));
vector(12, n, a(n)) \\ Altug Alkan, Oct 05 2015
(Python) # see LINKS
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Aug 23 2015
EXTENSIONS
a(13)-a(16) from Ivan N. Ianakiev, Aug 23 2015
a(17)-a(19) from Jinyuan Wang, Jun 27 2020
a(20)-a(22) from Lucas A. Brown, Mar 18 2024
STATUS
approved