OFFSET
1,5
COMMENTS
Parts will alternate between being odd and even. For even k, a composition cannot be the same as its reversal and therefore for even k, T(n,k) is even.
LINKS
Alois P. Heinz, Rows n = 1..200, flattened
EXAMPLE
Triangle begins:
1;
1, 0;
1, 2, 0;
1, 0, 1, 0;
1, 2, 1, 0, 0;
1, 0, 2, 2, 0, 0;
1, 2, 1, 0, 1, 0, 0;
1, 0, 1, 4, 1, 0, 0, 0;
1, 2, 2, 0, 3, 2, 0, 0, 0;
1, 0, 1, 4, 2, 0, 1, 0, 0, 0;
1, 2, 1, 0, 3, 6, 1, 0, 0, 0, 0;
1, 0, 2, 4, 3, 0, 4, 2, 0, 0, 0, 0;
1, 2, 1, 0, 3, 8, 3, 0, 1, 0, 0, 0, 0;
1, 0, 1, 4, 3, 0, 6, 8, 1, 0, 0, 0, 0, 0;
1, 2, 2, 0, 4, 10, 5, 0, 5, 2, 0, 0, 0, 0, 0;
...
For n = 6 there are a total of 5 compositions:
k = 1: (6)
k = 3: (123), (321)
k = 4: (2121), (1212)
MAPLE
b:= proc(n, i) option remember; `if`(n<1 or i<1, 0,
`if`(n=i, x, add(expand(x*b(n-i, i+j)), j=[-1, 1])))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(add(b(n, j), j=1..n)):
seq(T(n), n=1..14); # Alois P. Heinz, Jul 22 2023
MATHEMATICA
b[n_, i_] := b[n, i] = If[n < 1 || i < 1, 0, If[n == i, x, Sum[Expand[x*b[n - i, i + j]], {j, {-1, 1}}]]];
T[n_] := CoefficientList[Sum[b[n, j], {j, 1, n}], x] // Rest // PadRight[#, n]&;
Table[T[n], {n, 1, 13}] // Flatten (* Jean-François Alcover, Sep 06 2023, after Alois P. Heinz *)
PROG
(PARI)
step(R, n)={matrix(n, n, i, j, if(i>j, if(j>1, R[i-j, j-1]) + if(j+1<=n, R[i-j, j+1])) )}
T(n)={my(v=vector(n), R=matid(n), m=0); while(R, m++; v[m]+=vecsum(R[n, ]); R=step(R, n)); v}
for(n=1, 15, print(T(n)))
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Andrew Howroyd, Aug 23 2019
STATUS
approved