OFFSET
0,5
EXAMPLE
a(4) = 2: -1 - 3 - 6 + 10 = +1 + 3 + 6 - 10 = 0.
PROG
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def b(n, i):
if n > i*(i+1)*(i+2)//6: return 0
if i == 0: return 1
return b(n+i*(i+1)//2, i-1) + b(abs(n-i*(i+1)//2), i-1)
def a(n): return b(0, n) + b(1, n)
print([a(n) for n in range(41)]) # Michael S. Branicky, Jan 19 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jan 19 2022
STATUS
approved