login
A372631
Numbers m for which there exists some k < m where the sum of the natural numbers from k^2 to m^2 inclusive is a square.
3
4, 5, 7, 12, 15, 19, 29, 34, 41, 47, 55, 56, 65, 71, 73, 80, 84, 98, 111, 119, 124, 126, 141, 158, 165, 169, 175, 191, 209, 231, 239, 253, 260, 265, 287, 322, 335, 345, 352, 359, 369, 376, 403, 408, 425, 436, 444, 463, 465, 491, 505, 532, 542, 548, 587, 620
OFFSET
1,1
LINKS
EXAMPLE
4 is a term because the sum of all natural numbers from 3^2 to 4^2 inclusive is 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 = 100 = 10^2.
MATHEMATICA
a={}; For[m=1, m<=620, m++, flag=0; tot=m^2*(m^2+1)/2; For[k=1, k<m && flag == 0, k++, If[IntegerQ[Sqrt[tot-k^2(k^2-1)/2]], AppendTo[a, m]; flag=1]]]; a (* Stefano Spezia, May 11 2024 after Michael S. Branicky, May 10 2024 *)
PROG
(Python)
from math import isqrt
def ok(m):
tot = m**2*(m**2+1)//2
for k in range(1, m):
skm = tot - k**2*(k**2-1)//2
if isqrt(skm)**2 == skm:
return True
return False
print([m for m in range(621) if ok(m)]) # Michael S. Branicky, May 10 2024
(Python)
from itertools import count, islice
from sympy.abc import x, y
from sympy.ntheory.primetest import is_square
from sympy.solvers.diophantine.diophantine import diop_quadratic
def A372631_gen(startvalue=2): # generator of terms >= startvalue
for m in count(max(startvalue, 2)):
m2 = m**2
for k in diop_quadratic(m2*(m2+1)-x*(x-1)-2*y**2):
if (r:=int(k[0]))<m2 and is_square(r):
yield m
break
A372631_list = list(islice(A372631_gen(), 56)) # Chai Wah Wu, May 13 2024
CROSSREFS
Sequence in context: A079337 A160934 A032390 * A112918 A138920 A309833
KEYWORD
nonn
AUTHOR
Nicolay Avilov, May 07 2024
STATUS
approved