cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A259408 a(1) = 1 thereafter a(n) = Sum_{m=1..n-1} prime(a(m)).

This page as a plain text file.
%I A259408 #57 Oct 07 2022 20:03:46
%S A259408 1,2,5,16,69,416,3277,33590,430131,6700328,124069971,2680915918,
%T A259408 66579269891,1876496610172,59387269231505,2091422223924852,
%U A259408 81321166136299741,3467614972592015460
%N A259408 a(1) = 1 thereafter a(n) = Sum_{m=1..n-1} prime(a(m)).
%F A259408 a(n) = A014688(a(n-1)) for n>2, a(1)=1, a(2)=2.
%t A259408 a = {1}; Do[AppendTo[a, Sum[Prime[a[[m]]], {m, n - 1}]], {n, 2, 15}];
%t A259408 a (* _Michael De Vlieger_, Aug 06 2015 *)
%o A259408 (PARI) a(n) = if (n==1, 1, sum(k=1, n-1, prime(a(k)))); \\ _Michel Marcus_, Jun 26 2015
%o A259408 (PARI) first(m)=my(v=vector(m)); v[1]=1; print1(1); for(i=2, m, v[i]=sum(k=1, i-1, prime(v[k])); print1(", ", v[i])); v; \\ _Anders Hellström_, Aug 01 2015
%o A259408 (PARI) first(n)=my(v=vector(n,i,i)); for(i=3,n,v[i]=v[i-1]+prime(v[i-1])); v \\ _Charles R Greathouse IV_, Aug 06 2015
%o A259408 (Perl) use bignum;
%o A259408 use Math::Prime::Util ':all';
%o A259408 print "1\n2\n";
%o A259408 my $a = 2;
%o A259408 while(1){
%o A259408   $a += nth_prime($a);
%o A259408   print "$a\n";
%o A259408 } # _Charles R Greathouse IV_, Aug 06 2015
%o A259408 (Python)
%o A259408 from sympy import prime
%o A259408 from functools import lru_cache
%o A259408 @lru_cache()
%o A259408 def a(n): return n if n < 3 else a(n-1) + prime(a(n-1))
%o A259408 print([a(n) for n in range(1, 14)]) # _Michael S. Branicky_, Oct 07 2022
%Y A259408 Cf. A074271.
%K A259408 nonn,more
%O A259408 1,2
%A A259408 _Anders Hellström_, Jun 26 2015
%E A259408 a(15) from _Michael De Vlieger_, Jul 01 2015
%E A259408 a(16)-a(18) from _Charles R Greathouse IV_, Aug 06 2015