editing
approved
editing
approved
editing
approved
Number T(n,k) of Carlitz compositions of n with k exactly k descents; triangle T(n,k), n>=0, 0<=k<=floor(n/3), read by rows.
approved
editing
proposed
approved
editing
proposed
b[n_, i_] := b[n, i] = If[n == 0, 1, Expand[Sum[If[j == i, 0, b[n-j, j]*If[j<i, x, 1]], {j, 1, n}]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0]]; Table[T[n], {n, 0, 20}] // Flatten (* Jean-François Alcover, Feb 13 2015, after Alois P. Heinz *)
approved
editing
editing
approved
Number T(n,k) of Carlitz compositions of n with k exactly descents; triangle T(n,k), n>=0, 0<=k<=floor(n/3), read by rows.
b:= proc(n, i) option remember; `if`(n=0, 1, expand(
add(`if`(j=i, 0, b(n-j, j)*`if`(j<i, x, 1)), j=1..n)))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
seq(T(n), n=0..20);