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.

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.

Original entry on oeis.org

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

Views

Author

Nicolay Avilov, May 07 2024

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.
		

Crossrefs

Programs

  • Mathematica
    a={}; For[m=1, m<=620, m++, flag=0; tot=m^2*(m^2+1)/2; For[k=1, kStefano 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