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.

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

This page as a plain text file.
%I A350287 #54 Jan 27 2022 20:56:10
%S A350287 1,1,0,0,2,1,2,2,4,7,12,16,26,42,66,104,210,318,620,970,1748,3281,
%T A350287 5948,10480,18976,34233,60836,111430,209460,378529,704934,1284836,
%U A350287 2387758,4466874,8331820,15525814,28987902,54162165,101242982,190267598,358969426,674845081
%N A350287 Number of solutions to +-1 +- 3 +- 6 +- 10 +- ... +- n*(n + 1)/2 = 0 or 1.
%e A350287 a(4) = 2: -1 - 3 - 6 + 10 = +1 + 3 + 6 - 10 = 0.
%o A350287 (Python)
%o A350287 from functools import lru_cache
%o A350287 @lru_cache(maxsize=None)
%o A350287 def b(n, i):
%o A350287     if n > i*(i+1)*(i+2)//6: return 0
%o A350287     if i == 0: return 1
%o A350287     return b(n+i*(i+1)//2, i-1) + b(abs(n-i*(i+1)//2), i-1)
%o A350287 def a(n): return b(0, n) + b(1, n)
%o A350287 print([a(n) for n in range(41)]) # _Michael S. Branicky_, Jan 19 2022
%Y A350287 Cf. A000217, A025591, A058498, A158380.
%K A350287 nonn
%O A350287 0,5
%A A350287 _Ilya Gutkovskiy_, Jan 19 2022