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.
%I A350403 #20 Mar 01 2022 07:25:08 %S A350403 1,1,0,0,0,0,2,2,2,5,2,2,10,13,43,86,114,193,274,478,860,1552,3245, %T A350403 5808,10838,18628,31048,55626,100426,188536,372710,696164,1298600, %U A350403 2376996,4197425,7826992,14574366,27465147,53072709,100061106,187392994,351329160 %N A350403 Number of solutions to +-1^2 +- 2^2 +- 3^2 +- ... +- n^2 = 0 or 1. %e A350403 a(8) = 2: +1^2 - 2^2 - 3^2 + 4^2 - 5^2 + 6^2 + 7^2 - 8^2 = %e A350403 -1^2 + 2^2 + 3^2 - 4^2 + 5^2 - 6^2 - 7^2 + 8^2 = 0. %p A350403 b:= proc(n, i) option remember; `if`(n>i*(i+1)*(2*i+1)/6, 0, %p A350403 `if`(i=0, 1, b(n+i^2, i-1)+b(abs(n-i^2), i-1))) %p A350403 end: %p A350403 a:=n-> b(0, n)+b(1, n): %p A350403 seq(a(n), n=0..42); # _Alois P. Heinz_, Jan 16 2022 %t A350403 b[n_, i_] := b[n, i] = If[n > i*(i + 1)*(2*i + 1)/6, 0, %t A350403 If[i == 0, 1, b[n + i^2, i - 1] + b[Abs[n - i^2], i - 1]]]; %t A350403 a[n_] := b[0, n] + b[1, n]; %t A350403 Table[a[n], {n, 0, 42}] (* _Jean-François Alcover_, Mar 01 2022, after _Alois P. Heinz_ *) %o A350403 (Python) %o A350403 from itertools import product %o A350403 def a(n): %o A350403 if n == 0: return 1 %o A350403 nn = ["0"] + [str(i)+"**2" for i in range(1, n+1)] %o A350403 return sum(eval("".join([*sum(zip(nn, ops+("", )), ())])) in {0, 1} for ops in product("+-", repeat=n)) %o A350403 print([a(n) for n in range(18)]) # _Michael S. Branicky_, Jan 16 2022 %o A350403 (Python) %o A350403 from functools import cache %o A350403 @cache %o A350403 def b(n, i): %o A350403 if n > i*(i+1)*(2*i+1)//6: return 0 %o A350403 if i == 0: return 1 %o A350403 return b(n+i**2, i-1) + b(abs(n-i**2), i-1) %o A350403 def a(n): return b(0, n) + b(1, n) %o A350403 print([a(n) for n in range(43)]) # _Michael S. Branicky_, Jan 16 2022 after _Alois P. Heinz_ %Y A350403 Cf. A000290, A025591, A083527, A158092. %K A350403 nonn %O A350403 0,7 %A A350403 _Ilya Gutkovskiy_, Dec 29 2021