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
KEYWORD
sign,base
AUTHOR
Jean-Marc Rebert, Oct 23 2024
STATUS
approved