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.

A346134 The sum S of the maximum number of consecutive primes starting with 2 such that S <= prime(n)^2.

Original entry on oeis.org

2, 5, 17, 41, 100, 160, 281, 328, 501, 791, 874, 1264, 1593, 1720, 2127, 2747, 3447, 3638, 4438, 4888, 5117, 6081, 6870, 7699, 9206, 10191, 10538, 11240, 11599, 12718, 15968, 16840, 18650, 19113, 22039, 22548, 24133, 26369, 27517, 29897, 31734, 32353, 36227, 36888
Offset: 1

Views

Author

Gil Broussard, Jul 05 2021

Keywords

Examples

			a(3) = 2+3+5+7 = 17 because 17 <= prime(3)^2 < 28 = 2+3+5+7+11.
a(4) = 2+3+5+7+11+13 = 41 because 41 <= prime(4)^2 < 58 = 2+3+5+7+11+13+17.
		

Crossrefs

Programs

  • Mathematica
    Table[k=1;While[(s=Sum[Prime@i,{i,++k}])Giorgos Kalogeropoulos, Jul 06 2021 *)
  • PARI
    a(n) = my(s=0, p=2); while (s+p <= prime(n)^2, s += p; p = nextprime(p+1)); s; \\ Michel Marcus, Jul 05 2021
    
  • Python
    from sympy import prime, nextprime
    def a(n):
        p, s, lim = 1, 0, prime(n)**2
        while s <= lim: p = nextprime(p); s += p
        return s - p
    print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Jul 05 2021