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.

A377294 a(n) is the least n-digit prime which is the sum of the squares of three consecutive numbers, or -1 if no such prime exists.

Original entry on oeis.org

5, 29, 149, 1877, 11909, 100469, 1026677, 10013789, 100676549, 1000611509, 10007613149, 100003082789, 1000092600389, 10000275414869, 100000426365677, 1000004865589109, 10000013191662677, 100000034139489269, 1000000221045632669, 10000000313838962309, 100000002116695737029
Offset: 1

Views

Author

Jean-Marc Rebert, Oct 23 2024

Keywords

Examples

			29 is the smallest 2-digit prime number that can be expressed as the sum of the squares of three consecutive numbers. Specifically, the sum of the squares of the numbers from 2 to 4 is 29: Sum_{i=1..3} (1+i)^2 = 2^2 + 3^2 + 4^2 = 4 + 9 + 16 = 29.
		

Crossrefs

Primes in A120328.
Cf. A376992.

Programs

  • Python
    from math import isqrt
    from sympy import isprime
    from itertools import count
    def f(m): return sum((m+i)**2 for i in range(3))
    def a(n):
        b = 10**(n-1)
        m = isqrt(b//3) - 2
        m += m&1  # note: m must be even for f(m) to be odd
        return next(t for i in count(m, 2) if (t:=f(i)) >= b and isprime(t))
    print([a(n) for n in range(2, 22)]) # Michael S. Branicky, Oct 25 2024