login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Number of solutions to +-1 +- 3 +- 6 +- 10 +- ... +- n*(n + 1)/2 = 0 or 1.
1

%I #54 Jan 27 2022 20:56:10

%S 1,1,0,0,2,1,2,2,4,7,12,16,26,42,66,104,210,318,620,970,1748,3281,

%T 5948,10480,18976,34233,60836,111430,209460,378529,704934,1284836,

%U 2387758,4466874,8331820,15525814,28987902,54162165,101242982,190267598,358969426,674845081

%N Number of solutions to +-1 +- 3 +- 6 +- 10 +- ... +- n*(n + 1)/2 = 0 or 1.

%e a(4) = 2: -1 - 3 - 6 + 10 = +1 + 3 + 6 - 10 = 0.

%o (Python)

%o from functools import lru_cache

%o @lru_cache(maxsize=None)

%o def b(n, i):

%o if n > i*(i+1)*(i+2)//6: return 0

%o if i == 0: return 1

%o return b(n+i*(i+1)//2, i-1) + b(abs(n-i*(i+1)//2), i-1)

%o def a(n): return b(0, n) + b(1, n)

%o print([a(n) for n in range(41)]) # _Michael S. Branicky_, Jan 19 2022

%Y Cf. A000217, A025591, A058498, A158380.

%K nonn

%O 0,5

%A _Ilya Gutkovskiy_, Jan 19 2022