OFFSET
0,3
COMMENTS
We define the half-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A + B - C - D + E + F - G - ...
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1664
EXAMPLE
The a(0) = 1 through a(3) = 8 compositions:
() . (112) (123)
(1111) (213)
(1212)
(1221)
(2112)
(2121)
(11121)
(11211)
MAPLE
a:= proc(n) option remember; `if`(n<3, [1, 0, 2][n+1],
(8*(n-3)*(5*n-7)*(2*n-5)*a(n-3) -4*(5*n-12)*(n-2)^2*a(n-2)
+2*(2*n-5)*(5*n-7)*n*a(n-1))/((5*n-12)*(n+1)*(n-2)))
end:
seq(a(n), n=0..40); # Alois P. Heinz, Oct 19 2022
MATHEMATICA
halfats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[i/2]), {i, Length[f]}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[2n], halfats[#]==0&]], {n, 0, 7}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Oct 12 2022
EXTENSIONS
a(11)-a(26) from Alois P. Heinz, Oct 19 2022
STATUS
approved