OFFSET
1,1
LINKS
R. J. Mathar, Table of n, a(n) for n = 1..5908
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