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.

A013916 Numbers k such that the sum of the first k primes is prime.

Original entry on oeis.org

1, 2, 4, 6, 12, 14, 60, 64, 96, 100, 102, 108, 114, 122, 124, 130, 132, 146, 152, 158, 162, 178, 192, 198, 204, 206, 208, 214, 216, 296, 308, 326, 328, 330, 332, 334, 342, 350, 356, 358, 426, 446, 458, 460, 464, 480, 484, 488, 512, 530, 536, 548, 568, 620, 630, 676, 680
Offset: 1

Views

Author

N. J. A. Sloane, Renaud Lifchitz (100637.64(AT)CompuServe.COM)

Keywords

Examples

			6 is a term because the sum of the first six primes 2 + 3 + 5 + 7 + 11 + 13 = 41 is prime.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..5300],IsPrime);;
    a:=Filtered([1..Length(P)],n->IsPrime(Sum([1..n],k->P[k])));; Print(a); # Muniru A Asiru, Jan 04 2019
    
  • MATLAB
    p=primes(10000); m=1;
    for u=1:700 ; suma=sum(p(1:u));
         if isprime(suma)==1 ; sol(m)=u; m=m+1; end
    end
    sol; % Marius A. Burtea, Jan 04 2019
    
  • Magma
    [n:n in [1..700] | IsPrime(&+PrimesUpTo(NthPrime(n))) ]; // Marius A. Burtea, Jan 04 2019
    
  • Maple
    p:=proc(n) if isprime(sum(ithprime(k),k=1..n))=true then n else fi end: seq(p(n),n=1..690); # Emeric Deutsch
  • Mathematica
    s = 0; Do[s = s + Prime[n]; If[PrimeQ[s], Print[n]], {n, 1, 1000}]
    Flatten[Position[Accumulate[Prime[Range[2000]]], ?(PrimeQ[#] &)]] (* _Harvey P. Dale, Dec 16 2010 *)
    Flatten[Position[PrimeQ[Accumulate[Prime[Range[2000]]]],True]] (* Fred Patrick Doty, Aug 15 2017 *)
  • PARI
    isA013916(n) = isprime(sum(i=1,n,prime(i))) \\ Michael B. Porter, Jan 29 2010
    
  • Python
    from sympy import isprime, prime
    def aupto(lim):
      s = 0
      for k in range(1, lim+1):
        s += prime(k)
        if isprime(s): print(k, end=", ")
    aupto(680) # Michael S. Branicky, Feb 28 2021

Formula

a(n) = A000720(A013917(n)).

Extensions

More terms from David W. Wilson