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.

A368590 Numbers k such that all of k, k+1 and k+2 are the sums of consecutive squares.

Original entry on oeis.org

728, 1013, 2813, 3309, 4323, 4899, 12438, 21259, 23113, 31394, 35719, 37812, 38023, 111894, 143449, 194053, 418613, 418614, 487368, 535309, 2232593, 2452644, 2490669, 9226854, 17367998, 19637644, 20341453, 28553671, 33406839, 174398434, 468936719, 1468970139, 2136314464
Offset: 1

Views

Author

David A. Corneth, Dec 31 2023

Keywords

Comments

418613 is the smallest k such that k through k + 3 are the sums of consecutive squares.
After an idea by Allan C. Wechsler.
a(30)-a(33) were calculated using the b-file at A368570.

Examples

			728 is in the sequence via 728 = 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2 + 13^2, 729 = 27^2 and 730 = 10^2 + 11^2 + 12^2 + 13^2 + 14^2.
		

Crossrefs

Subsequence of A034705 and of A368570.

Programs

  • PARI
    \\ See PARI program
    
  • Python
    import heapq
    from itertools import islice
    def agen(): # generator of terms
        m = 1; h = [(m, 1, 1)]; nextcount = 2
        v1 = v2 = -1
        while True:
            (v, s, l) = heapq.heappop(h)
            if v != v1:
                if v2 + 2 == v1 + 1 == v: yield v2
                v2, v1 = v1, v
            if v >= m:
                m += nextcount*nextcount
                heapq.heappush(h, (m, 1, nextcount))
                nextcount += 1
            v -= s*s; s += 1; l += 1; v += l*l
            heapq.heappush(h, (v, s, l))
    print(list(islice(agen(), 33))) # Michael S. Branicky, Jan 01 2024