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.
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
Keywords
Examples
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.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..1301
- Nicolay Avilov, Problem 1876. Segment of a natural series (in Russian).
Programs
-
Mathematica
a={}; For[m=1, m<=620, m++, flag=0; tot=m^2*(m^2+1)/2; For[k=1, k
Stefano Spezia, May 11 2024 after Michael S. Branicky, May 10 2024 *) -
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]))
A372631_list = list(islice(A372631_gen(),56)) # Chai Wah Wu, May 13 2024