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.

A348165 Number of solutions to +-1^2 +- 2^2 +- 3^2 +- ... +- n^2 = n.

Original entry on oeis.org

1, 1, 0, 0, 1, 2, 0, 0, 2, 4, 0, 0, 19, 29, 0, 0, 127, 208, 0, 0, 1121, 1917, 0, 0, 10479, 19360, 0, 0, 113213, 204121, 0, 0, 1290968, 2363982, 0, 0, 15303057, 28397538, 0, 0, 187446097, 351339307, 0, 0, 2355979330, 4455357992, 0, 0, 30360404500, 57630025172
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 28 2022

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; (m-> `if`(n>m, 0, `if`(n=m, 1,
          b(abs(n-i^2), i-1)+b(n+i^2, i-1))))((1+(3+2*i)*i)*i/6)
        end:
    a:= n-> `if`(irem(n, 4)>1, 0, b(n$2)):
    seq(a(n), n=0..50);  # Alois P. Heinz, Jan 28 2022
  • Mathematica
    b[n_, i_] := b[n, i] = Function[m, If[n > m, 0, If[n == m, 1, b[Abs[n - i^2], i - 1] + b[n + i^2, i - 1]]]][(1 + (3 + 2*i)*i)*i/6];
    a[n_] := If[Mod[n, 4] > 1, 0, b[n, n]];
    Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Feb 26 2022, after Alois P. Heinz *)
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def b(n, i):
        if n > i*(i+1)*(2*i+1)//6: return 0
        if i == 0: return 1
        return b(n+i**2, i-1) + b(abs(n-i**2), i-1)
    def a(n): return b(n, n)
    print([a(n) for n in range(50)]) # Michael S. Branicky, Jan 28 2022

Formula

a(n) = [x^n] Product_{k=1..n} (x^(k^2) + 1/x^(k^2)).