OFFSET
1,1
COMMENTS
For prime terms see A034962. - Zak Seidov, Feb 17 2011
LINKS
Zak Seidov, Table of n, a(n) for n = 1..1000
Carlos Rivera, Puzzle 1021. p(k)+p(k+1)+1, The Prime Puzzles and Problems Connection.
FORMULA
a(n) = Sum_{k=0..2} A000040(n+k). - Omar E. Pol, Feb 28 2020
EXAMPLE
a(1) = 10 = 2 + 3 + 5.
a(42) = 565 = 181 + 191 + 193.
MATHEMATICA
Plus @@@ Partition[ Prime[ Range[60]], 3, 1] (* Robert G. Wilson v, Feb 11 2005 *)
3 MovingAverage[Prime[Range[60]], {1, 1, 1}] (* Jean-François Alcover, Nov 12 2018 *)
PROG
(Sage)
BB = primes_first_n(57)
L = []
for i in range(55):
L.append(BB[i]+BB[i+1]+BB[i+2])
L # Zerinvary Lajos, May 14 2007
(Magma) [&+[ NthPrime(n+k): k in [0..2] ]: n in [1..50] ]; // Vincenzo Librandi, Apr 03 2011
(PARI) a(n)=my(p=prime(n), q=nextprime(p+1)); p+q+nextprime(q+1) \\ Charles R Greathouse IV, Jul 01 2013
(PARI) is(n)=my(p=precprime(n\3), q=nextprime(n\3+1), r=n-p-q); if(r>q, r==nextprime(q+2), r==precprime(p-1) && r) \\ Charles R Greathouse IV, Jul 05 2017
(Python)
from sympy import nextprime
from itertools import count, islice
def agen(): # generator of terms
p, q, r = 2, 3, 5
while True:
yield p + q + r
p, q, r = q, r, nextprime(r)
print(list(islice(agen(), 54))) # Michael S. Branicky, Dec 27 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Patrick De Geest, Oct 15 1998
STATUS
approved