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.

A071150 Primes p such that the sum of all odd primes <= p is also a prime.

This page as a plain text file.
%I A071150 #21 Mar 29 2021 20:59:30
%S A071150 3,29,53,61,251,263,293,317,359,383,503,641,647,787,821,827,911,1097,
%T A071150 1163,1249,1583,1759,1783,1861,1907,2017,2287,2297,2593,2819,2837,
%U A071150 2861,3041,3079,3181,3461,3541,3557,3643,3779,4259,4409,4457,4597,4691,4729,4789
%N A071150 Primes p such that the sum of all odd primes <= p is also a prime.
%H A071150 R. J. Mathar, <a href="/A071150/b071150.txt">Table of n, a(n) for n = 1..5908</a>
%e A071150 29 is a prime and 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 = 127 (also a prime), so 29 is a term. - _Jon E. Schoenfield_, Mar 29 2021
%p A071150 SoddP := proc(n)
%p A071150     option remember;
%p A071150     if n <= 2 then
%p A071150         0;
%p A071150     elif isprime(n) then
%p A071150         procname(n-1)+n;
%p A071150     else
%p A071150         procname(n-1);
%p A071150     fi ;
%p A071150 end proc:
%p A071150 isA071150 := proc(n)
%p A071150     if isprime(n) and isprime(SoddP(n)) then
%p A071150         true;
%p A071150     else
%p A071150         false;
%p A071150     end if;
%p A071150 end proc:
%p A071150 n := 1 ;
%p A071150 for i from 3 by 2 do
%p A071150     if isA071150(i) then
%p A071150         printf("%d %d\n",n,i) ;
%p A071150         n := n+1 ;
%p A071150     end if;
%p A071150 end do: # _R. J. Mathar_, Feb 13 2015
%t A071150 Function[s, Select[Array[Take[s, #] &, Length@ s], PrimeQ@ Total@ # &][[All, -1]]]@ Prime@ Range[2, 640] (* _Michael De Vlieger_, Jul 18 2017 *)
%t A071150 Module[{nn=650,pr},pr=Prime[Range[2,nn]];Table[If[PrimeQ[Total[Take[ pr, n]]], pr[[n]],Nothing],{n,nn-1}]] (* _Harvey P. Dale_, May 12 2018 *)
%o A071150 (Python)
%o A071150 from sympy import isprime, nextprime
%o A071150 def aupto(limit):
%o A071150   p, s, alst = 3, 3, []
%o A071150   while p <= limit:
%o A071150     if isprime(s): alst.append(p)
%o A071150     p = nextprime(p)
%o A071150     s += p
%o A071150   return alst
%o A071150 print(aupto(4789)) # _Michael S. Branicky_, Mar 29 2021
%Y A071150 Analogous to A013917.
%Y A071150 Cf. A065091, A071148, A071149, A013916, A013917, A013918, A007504.
%K A071150 easy,nonn
%O A071150 1,1
%A A071150 _Labos Elemer_, May 13 2002