cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A034961 Sums of three consecutive primes.

Original entry on oeis.org

10, 15, 23, 31, 41, 49, 59, 71, 83, 97, 109, 121, 131, 143, 159, 173, 187, 199, 211, 223, 235, 251, 269, 287, 301, 311, 319, 329, 349, 371, 395, 407, 425, 439, 457, 471, 487, 503, 519, 533, 551, 565, 581, 589, 607, 633, 661, 679, 689, 701, 713, 731, 749, 771
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Comments

For prime terms see A034962. - Zak Seidov, Feb 17 2011

Examples

			a(1) = 10 = 2 + 3 + 5.
a(42) = 565 = 181 + 191 + 193.
		

Crossrefs

Programs

  • Magma
    [&+[ NthPrime(n+k): k in [0..2] ]: n in [1..50] ]; // Vincenzo Librandi, Apr 03 2011
    
  • 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 *)
  • 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
  • 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
    

Formula

a(n) = Sum_{k=0..2} A000040(n+k). - Omar E. Pol, Feb 28 2020
a(n) = A001043(n) + A000040(n+2). - R. J. Mathar, May 25 2020