login
A071150
Primes p such that the sum of all odd primes <= p is also a prime.
4
3, 29, 53, 61, 251, 263, 293, 317, 359, 383, 503, 641, 647, 787, 821, 827, 911, 1097, 1163, 1249, 1583, 1759, 1783, 1861, 1907, 2017, 2287, 2297, 2593, 2819, 2837, 2861, 3041, 3079, 3181, 3461, 3541, 3557, 3643, 3779, 4259, 4409, 4457, 4597, 4691, 4729, 4789
OFFSET
1,1
LINKS
EXAMPLE
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
MAPLE
SoddP := proc(n)
option remember;
if n <= 2 then
0;
elif isprime(n) then
procname(n-1)+n;
else
procname(n-1);
fi ;
end proc:
isA071150 := proc(n)
if isprime(n) and isprime(SoddP(n)) then
true;
else
false;
end if;
end proc:
n := 1 ;
for i from 3 by 2 do
if isA071150(i) then
printf("%d %d\n", n, i) ;
n := n+1 ;
end if;
end do: # R. J. Mathar, Feb 13 2015
MATHEMATICA
Function[s, Select[Array[Take[s, #] &, Length@ s], PrimeQ@ Total@ # &][[All, -1]]]@ Prime@ Range[2, 640] (* Michael De Vlieger, Jul 18 2017 *)
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 *)
PROG
(Python)
from sympy import isprime, nextprime
def aupto(limit):
p, s, alst = 3, 3, []
while p <= limit:
if isprime(s): alst.append(p)
p = nextprime(p)
s += p
return alst
print(aupto(4789)) # Michael S. Branicky, Mar 29 2021
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Labos Elemer, May 13 2002
STATUS
approved