OFFSET
0,6
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..200
FORMULA
a(n) = [x^n] Product_{k=1..n} (x^(k^2) + 1/x^(k^2)).
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jan 28 2022
STATUS
approved