%I #53 Feb 02 2022 09:40:14
%S 1,0,0,0,2,0,2,2,4,0,12,16,26,0,66,104,210,0,620,970,1748,0,5948,
%T 10480,18976,0,60836,111430,209460,0,704934,1284836,2387758,0,8331820,
%U 15525814,28987902,0,101242982,190267598,358969426,0,1275032260,2404124188,4547419694
%N Number of solutions to +-1 +- 3 +- 6 +- ... +- n(n+1)/2 = 0.
%C Equivalently, number of partitions of the set of the first n triangular numbers {t(1),...,t(n)} into two classes with equal sums.
%C Constant term in the expansion of (x + 1/x)(x^3 + 1/x^3)...(x^t(n) + 1/x^t(n)).
%C a(n) = 0 for all n == 1 (mod 4).
%C Andrica & Tomescu give a more general integral formula than the one below. - _Jonathan Sondow_, Nov 11 2013
%H Ray Chandler, <a href="/A158380/b158380.txt">Table of n, a(n) for n = 0..633</a>
%H Dorin Andrica and Ioan Tomescu, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL5/Tomescu/tomescu4.html">On an Integer Sequence Related to a Product of Trigonometric Functions, and Its Combinatorial Relevance</a>, J. Integer Sequences, 5 (2002), Article 02.2.4.
%F a(n) = (2^n/Pi) * Integral_{x=0..Pi} cos(x)*cos(3x)*...*cos(n(n+1)x/2) dx.
%F a(n) ~ 2^(n+1)*sqrt(10/Pi)*n^(-5/2)*(1+o(1)) as n --> infinity, n !== 1 (mod 4).
%F a(n) = 2 * A058498(n) for n > 0. - _Alois P. Heinz_, Nov 01 2011
%e For n=6 the 2 solutions are +1-3+6-10-15+21 = 0 and -1+3-6+10+15-21 = 0.
%p N:=70: p:=1: a:=[]: for n from 0 to N do
%p p:=expand(p*(x^(n*(n+1)/2)+x^(-n*(n+1)/2))):
%p a:=[op(a), coeff(p, x, 0)]: od:a;
%p # second Maple program:
%p b:= proc(n, i) option remember; (m-> `if`(n>m, 0,
%p `if`(n=m, 1, b(abs(n-i*(i+1)/2), i-1)+
%p b(n+i*(i+1)/2, i-1))))((2+(3+i)*i)*i/6)
%p end:
%p a:= n-> `if`(irem(n, 4)=1, 0, b(0, n)):
%p seq(a(n), n=0..50); # _Alois P. Heinz_, Sep 17 2017
%t a[n_] := With[{t = Table[k(k+1)/2, {k, 1, n}]}, Coefficient[Times @@ (x^t + 1/x^t), x, 0]];
%t Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 0, 50}] (* _Jean-François Alcover_, Jun 16 2018 *)
%o (PARI) t(k) = k*(k+1)/2;
%o a(n) = polcoeff(prod(k=1, n, (x^t(k)+ 1/x^t(k))), 0); \\ _Michel Marcus_, May 19 2015
%Y Cf. A058498, A063865, A158092, A158118.
%K easy,nonn
%O 0,5
%A _Pietro Majer_, Mar 17 2009
%E a(0) = 1 prepended by _Joerg Arndt_, Sep 17 2017
%E Example corrected by _Ilya Gutkovskiy_, Feb 02 2022
|