Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #31 Mar 19 2024 03:17:10
%S 1,1,2,6,22,92,508,3674,34452,408104,5925564,103023888,2102941162,
%T 49588317960,1332831700026,40376512041704,1365483356241318,
%U 51130344360226830,2104788801045148866,94659739599219674872,4625501078986781603540,244380566194237434434094
%N a(n+1) = prime(n + a(n)) - prime(n), a(1) = 1.
%H Lucas A. Brown, <a href="https://github.com/lucasaugustus/oeis/blob/main/A261518.py">Python program</a>.
%t FoldList[(Prime[#2+#1]-Prime[#2])&,1,Range@15] (* _Ivan N. Ianakiev_, Aug 23 2015 *)
%t RecurrenceTable[{a[n+1] == Prime[n+a[n]] - Prime[n], a[1]==1}, a, {n, 1,16}] (* _G. C. Greubel_, Aug 24 2015 *)
%t nxt[{n_,a_}]:={n+1,Prime[n+a]-Prime[n]}; NestList[nxt,{1,1},16][[All,2]] (* _Harvey P. Dale_, May 15 2018 *)
%o (Haskell)
%o a261518 n = a261518_list !! (n - 1)
%o a261518_list = 1 : zipWith (-)
%o (map a000040 (zipWith (+) a261518_list [1..])) a000040_list
%o (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
%o (PARI) a(n) = if(n==1, 1, prime(n-1 + a(n-1)) - prime(n-1));
%o vector(12, n, a(n)) \\ _Altug Alkan_, Oct 05 2015
%o (Python) # see LINKS
%Y Cf. A000040, A001223, A031131, A031165, A031166, A031167, A031168, A031169, A031170, A031171, A031172.
%K nonn
%O 1,3
%A _Reinhard Zumkeller_, Aug 23 2015
%E a(13)-a(16) from _Ivan N. Ianakiev_, Aug 23 2015
%E a(17)-a(19) from _Jinyuan Wang_, Jun 27 2020
%E a(20)-a(22) from _Lucas A. Brown_, Mar 18 2024