OFFSET
1,1
COMMENTS
Or, primes in A034961 (Sums of three consecutive primes). - Zak Seidov, Feb 16 2011
LINKS
EXAMPLE
E.g., 131 = 41 + 43 + 47.
A034962(n) = p+q+r, where p = A073681(n), and p<q<r are three consecutive primes. - Zak Seidov, Mar 09 2009
MAPLE
a:=proc(n) if isprime(ithprime(n)+ithprime(n+1)+ithprime(n+2))=true then ithprime(n)+ithprime(n+1)+ithprime(n+2) else fi end: seq(a(n), n=1..120); # Emeric Deutsch, Apr 24 2006
MATHEMATICA
a = {}; Do[k = Prime[x] + Prime[x + 1] + Prime[x + 2]; If[PrimeQ[k], AppendTo[a, k]], {x, 1, 350}]; a (* Artur Jasinski, Jan 27 2007 *)
Select[(Plus@@@Partition[Prime[Range[200]], 3, 1]), PrimeQ] (* Zak Seidov, Feb 07 2012 *)
Select[ListConvolve[{1, 1, 1}, Prime[Range[200]]], PrimeQ] (* Harvey P. Dale, Jul 12 2013 *)
PROG
(PARI) forprime(p=2, 1000, p2=nextprime(p+1); p3=nextprime(p2+1); q=p+p2+p3; if(isprime(q), print1(q", ")) ) \\ Max Alekseyev, Jan 26 2007
(PARI) {p=2; q=3; for(n=1, 100, r=nextprime(q+1); if(isprime(t=p+q+r), print1(t", ")); p=q; q=r; )} \\ Zak Seidov, Mar 09 2009
(Magma) [a: n in [1..150] | IsPrime(a) where a is NthPrime(n)+NthPrime(n+1)+NthPrime(n+2)]; // Vincenzo Librandi, Jun 23 2016
(Python)
from itertools import count, islice
from sympy import isprime, nextprime
def agen(): # generator of terms
p, q, r = 2, 3, 5
while True:
if isprime(p+q+r): yield p+q+r
p, q, r = q, r, nextprime(r)
print(list(islice(agen(), 50))) # Michael S. Branicky, Dec 27 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Patrick De Geest, Oct 15 1998
STATUS
approved