login
Sums of three consecutive primes.
53

%I #64 Dec 28 2022 02:13:33

%S 10,15,23,31,41,49,59,71,83,97,109,121,131,143,159,173,187,199,211,

%T 223,235,251,269,287,301,311,319,329,349,371,395,407,425,439,457,471,

%U 487,503,519,533,551,565,581,589,607,633,661,679,689,701,713,731,749,771

%N Sums of three consecutive primes.

%C For prime terms see A034962. - _Zak Seidov_, Feb 17 2011

%H Zak Seidov, <a href="/A034961/b034961.txt">Table of n, a(n) for n = 1..1000</a>

%H Carlos Rivera, <a href="https://www.primepuzzles.net/puzzles/puzz_1021.htm">Puzzle 1021. p(k)+p(k+1)+1</a>, The Prime Puzzles and Problems Connection.

%F a(n) = Sum_{k=0..2} A000040(n+k). - _Omar E. Pol_, Feb 28 2020

%F a(n) = A001043(n) + A000040(n+2). - _R. J. Mathar_, May 25 2020

%e a(1) = 10 = 2 + 3 + 5.

%e a(42) = 565 = 181 + 191 + 193.

%t Plus @@@ Partition[ Prime[ Range[60]], 3, 1] (* _Robert G. Wilson v_, Feb 11 2005 *)

%t 3 MovingAverage[Prime[Range[60]], {1, 1, 1}] (* _Jean-François Alcover_, Nov 12 2018 *)

%o (Sage)

%o BB = primes_first_n(57)

%o L = []

%o for i in range(55):

%o L.append(BB[i]+BB[i+1]+BB[i+2])

%o L # _Zerinvary Lajos_, May 14 2007

%o (Magma) [&+[ NthPrime(n+k): k in [0..2] ]: n in [1..50] ]; // _Vincenzo Librandi_, Apr 03 2011

%o (PARI) a(n)=my(p=prime(n),q=nextprime(p+1)); p+q+nextprime(q+1) \\ _Charles R Greathouse IV_, Jul 01 2013

%o (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

%o (Python)

%o from sympy import nextprime

%o from itertools import count, islice

%o def agen(): # generator of terms

%o p, q, r = 2, 3, 5

%o while True:

%o yield p + q + r

%o p, q, r = q, r, nextprime(r)

%o print(list(islice(agen(), 54))) # _Michael S. Branicky_, Dec 27 2022

%Y Cf. A001043, A011974, A034707, A034962, A034963.

%K nonn,easy

%O 1,1

%A _Patrick De Geest_, Oct 15 1998