OFFSET
0,5
COMMENTS
LINKS
Alois P. Heinz, Rows n = 0..141, flattened
M. Bona and A. Knopfmacher, On the probability that certain compositions have the same number of parts, Ann. Comb., 14 (2010), 291-306.
FORMULA
G.f. G=G(t,z) satisfies z^3*(1+z-t*z)*G^2 - (1-t*z-z^2+t*z^3-z^3)*G+1+z-t*z=0.
EXAMPLE
Row 3 is 3,0,1. Indeed, the four paths of weight 3 are: ud, hH, Hh, and hhh, having 0, 0, 0, and 2 hh's, respectively.
Triangle starts:
1;
1;
1,1;
3,0,1;
5,2,0,1;
9,5,2,0,1;
MAPLE
eq := z^3*(1+z-t*z)*G^2-(-z^3+1-z^2-t*z+t*z^3)*G+1+z-t*z = 0: g := RootOf(eq, G): gser := simplify(series(g, z = 0, 18)): for j from 0 to 15 do P[j] := coeff(gser, z, j) end do: 1; for j to 13 do seq(coeff(P[j], t, q), q = 0 .. j-1) end do; # yields sequence in triangular form
# second Maple program:
b:= proc(n, y, t) option remember; `if`(y<0 or y>n, 0, `if`(n=0, 1,
expand(b(n-1, y, 1)*`if`(t=1, x, 1)+ `if`(n>1, b(n-2, y, 0)+
b(n-2, y+1, 0), 0) +b(n-1, y-1, 0))))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2)):
seq(T(n), n=0..12); # Alois P. Heinz, Aug 24 2014
MATHEMATICA
b[n_, y_, t_] := b[n, y, t] = If[y<0 || y>n, 0, If[n==0, 1, Expand[b[n-1, y, 1] * If[t==1, x, 1] + If[n>1, b[n-2, y, 0] + b[n-2, y+1, 0], 0] + b[n-1, y-1, 0]]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0, 0]]; Table[T[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Jun 29 2015, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Emeric Deutsch, Aug 23 2014
STATUS
approved