login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A350287
Number of solutions to +-1 +- 3 +- 6 +- 10 +- ... +- n*(n + 1)/2 = 0 or 1.
1
1, 1, 0, 0, 2, 1, 2, 2, 4, 7, 12, 16, 26, 42, 66, 104, 210, 318, 620, 970, 1748, 3281, 5948, 10480, 18976, 34233, 60836, 111430, 209460, 378529, 704934, 1284836, 2387758, 4466874, 8331820, 15525814, 28987902, 54162165, 101242982, 190267598, 358969426, 674845081
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