login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A377295
a(n) is the least n-digit prime which is the sum of the squares of six consecutive numbers, or -1 if no such prime exists.
0
-1, -1, 139, 1279, 15319, 102199, 1011079, 10054399, 100687891, 1000860859, 10004248351, 100048116199, 1000245990631, 10000171206199, 100000029166651, 1000000001958499, 10000010020185919, 100000022659152859, 1000000088358667051, 10000000476596855539, 100000000728055460899
OFFSET
1,3
EXAMPLE
139 is the smallest 3-digit prime number that can be expressed as the sum of the squares of six consecutive numbers. Specifically, the sum of the squares of the numbers from 2 to 7 is 139:
Sum_{i=1..6} (1+i)^2 = 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 = 4 + 9 + 16 + 25 + 36 + 49 = 139.
PROG
(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(6))
def a(n):
b = 10**(n-1)
m = isqrt(b//6) - 5
return next(t for i in count(m) if (t:=f(i)) >= b and isprime(t))
print([a(n) for n in range(3, 23)]) # Michael S. Branicky, Oct 25 2024
CROSSREFS
Primes in A027865.
Cf. A376992.
Sequence in context: A001163 A276263 A140791 * A358400 A175017 A271977
KEYWORD
sign,base
AUTHOR
Jean-Marc Rebert, Oct 23 2024
STATUS
approved