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.

This page as a plain text file.
%I A013916 #57 Sep 08 2022 08:44:38
%S A013916 1,2,4,6,12,14,60,64,96,100,102,108,114,122,124,130,132,146,152,158,
%T A013916 162,178,192,198,204,206,208,214,216,296,308,326,328,330,332,334,342,
%U A013916 350,356,358,426,446,458,460,464,480,484,488,512,530,536,548,568,620,630,676,680
%N A013916 Numbers k such that the sum of the first k primes is prime.
%H A013916 David W. Wilson, <a href="/A013916/b013916.txt">Table of n, a(n) for n = 1..10000</a>
%H A013916 Romeo Meštrović, <a href="https://arxiv.org/abs/1804.04198">Curious conjectures on the distribution of primes among the sums of the first 2n primes</a>, arXiv:1804.04198 [math.NT], 2018.
%F A013916 a(n) = A000720(A013917(n)).
%e A013916 6 is a term because the sum of the first six primes 2 + 3 + 5 + 7 + 11 + 13 = 41 is prime.
%p A013916 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_
%t A013916 s = 0; Do[s = s + Prime[n]; If[PrimeQ[s], Print[n]], {n, 1, 1000}]
%t A013916 Flatten[Position[Accumulate[Prime[Range[2000]]], _?(PrimeQ[#] &)]] (* _Harvey P. Dale_, Dec 16 2010 *)
%t A013916 Flatten[Position[PrimeQ[Accumulate[Prime[Range[2000]]]],True]] (* _Fred Patrick Doty_, Aug 15 2017 *)
%o A013916 (PARI) isA013916(n) = isprime(sum(i=1,n,prime(i))) \\ _Michael B. Porter_, Jan 29 2010
%o A013916 (Magma) [n:n in [1..700] | IsPrime(&+PrimesUpTo(NthPrime(n))) ]; // _Marius A. Burtea_, Jan 04 2019
%o A013916 (MATLAB) p=primes(10000); m=1;
%o A013916 for u=1:700 ; suma=sum(p(1:u));
%o A013916      if isprime(suma)==1 ; sol(m)=u; m=m+1; end
%o A013916 end
%o A013916 sol; % _Marius A. Burtea_, Jan 04 2019
%o A013916 (GAP) P:=Filtered([1..5300],IsPrime);;
%o A013916 a:=Filtered([1..Length(P)],n->IsPrime(Sum([1..n],k->P[k])));; Print(a); # _Muniru A Asiru_, Jan 04 2019
%o A013916 (Python)
%o A013916 from sympy import isprime, prime
%o A013916 def aupto(lim):
%o A013916   s = 0
%o A013916   for k in range(1, lim+1):
%o A013916     s += prime(k)
%o A013916     if isprime(s): print(k, end=", ")
%o A013916 aupto(680) # _Michael S. Branicky_, Feb 28 2021
%Y A013916 Cf. A007504, A013917, A013918.
%K A013916 nonn,nice
%O A013916 1,2
%A A013916 _N. J. A. Sloane_, Renaud Lifchitz (100637.64(AT)CompuServe.COM)
%E A013916 More terms from _David W. Wilson_