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.

Showing 1-2 of 2 results.

A364143 a(n) is the minimal number of consecutive squares needed to sum to A216446(n).

Original entry on oeis.org

2, 5, 3, 2, 2, 3, 10, 2, 7, 9, 12, 11, 6, 11, 14, 3, 11, 29, 14, 7, 23, 4, 49, 8, 24, 5, 17, 12, 38, 46, 27, 34, 6, 14, 22, 66, 11, 66, 14, 11, 6, 77, 36, 63, 96, 11, 50, 3, 19, 96, 52, 41, 66, 33, 11, 3, 14, 121, 66, 89, 34, 127, 51, 2, 86, 54, 181, 48, 8
Offset: 1

Views

Author

DarĂ­o Clavijo, Jul 10 2023

Keywords

Examples

			a(8) = 7 is because 7 consecutive squares are needed to sum to A216446(8) = 595 = 6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2.
		

Crossrefs

Programs

  • Python
    is_palindrome = lambda n: str(n) == str(n)[::-1]
    def g(L):
      L2, squares, D = L*L, [x*x for x in range(0, L + 1)], {}
      for i in range(1, L + 1):
        for j in range(i + 1, L + 1):
          candidate = sum(squares[i:j+1])
          if candidate < L2 and is_palindrome(candidate):
            if candidate in D:
              D[candidate]= min(D[candidate], j-i-1)
            else:
              D[candidate] = j-i+1
      return [D[k] for k in sorted(D.keys())]
    print(g(1000))

A180436 Palindromic numbers which are sum of consecutive squares.

Original entry on oeis.org

1, 4, 5, 9, 55, 77, 121, 181, 313, 434, 484, 505, 545, 595, 636, 676, 818, 1001, 1111, 1441, 1771, 4334, 6446, 10201, 12321, 14641, 17371, 17871, 19691, 21712, 40804, 41214, 42924, 44444, 44944, 46564, 51015, 65756, 69696, 81818, 94249, 97679, 99199
Offset: 1

Views

Author

Zhining Yang, Jan 19 2011

Keywords

Comments

In more than one way: 554455, 9343439, ... (A267600) - Robert G. Wilson v, May 28 2012

Examples

			1001 is in the sequence because 1001 is palindromic and it can be written as sum of consecutive squares (1001 = 4^2 + 5^2 + 6^2 + ... + 13^2 + 14^2).
		

Crossrefs

Programs

  • Mathematica
    palQ[n_Integer] := Block[{idn = IntegerDigits[n]}, idn == Reverse[idn]]; lst = {}; k = 1; While[k < 1000, AppendTo[lst, Select[ Accumulate[ Range[k, 1000]^2], palQ]]; lst = Union@ Flatten@ lst; k++]; Select[lst, # < 10^6 &] (* Robert G. Wilson v, May 28 2012 *)
Showing 1-2 of 2 results.