OFFSET
0,5
COMMENTS
The matrices (A345197) count the integer compositions of n of length k with alternating sum i, where 1 <= k <= n, and i ranges from -n + 2 to n in steps of 2. Here, the alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i. So a(n) is the number of compositions of n of length (n + s)/2, where s is the alternating sum of the composition.
EXAMPLE
The a(0) = 1 through a(7) = 15 compositions of n = 0..7 of length (n + s)/2 where s = alternating sum (empty column indicated by dot):
() (1) . (2,1) (2,2) (2,3) (2,4) (2,5)
(1,1,2) (1,2,2) (1,3,2) (1,4,2)
(2,1,1) (2,2,1) (2,3,1) (2,4,1)
(1,1,3,1) (1,1,3,2)
(2,1,2,1) (1,2,3,1)
(3,1,1,1) (2,1,2,2)
(2,2,2,1)
(3,1,1,2)
(3,2,1,1)
(1,1,1,1,3)
(1,1,2,1,2)
(1,1,3,1,1)
(2,1,1,1,2)
(2,1,2,1,1)
(3,1,1,1,1)
MATHEMATICA
ats[y_]:=Sum[(-1)^(i-1)*y[[i]], {i, Length[y]}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], Length[#]==(n+ats[#])/2&]], {n, 0, 15}]
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Gus Wiseman, Jul 26 2021
STATUS
approved