OFFSET
0,3
COMMENTS
LINKS
Alois P. Heinz, Rows n = 0..250, 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 G = 1 + z*G + z^2*G + t*z^3*g*G, where g=1+z*g+z^2*g+z^3*g^2.
EXAMPLE
Row 3 is 3,1. Indeed, denoting by h (H) the (1,0)-step of weight 1 (2), and u=(1,1), d=(1,-1), the four paths of weight 3 are: ud, hH, Hh, and hhh, having 1, 0, 0, and 0 returns to the horizontal axis, respectively.
Triangle starts:
1;
1;
2;
3,1;
5,3;
8,9;
13,23,1;
MAPLE
eq := g = 1+z*g+z^2*g+z^3*g^2: g := RootOf(eq, g): G := 1/(1-z-z^2-t*z^3*g): Gser := simplify(series(G, z = 0, 20)): for n from 0 to 18 do P[n] := sort(coeff(Gser, z, n)) end do: for n from 0 to 18 do seq(coeff(P[n], t, k), k = 0 .. floor((1/3)*n)) end do; # yields sequence in triangular form
# second Maple program:
b:= proc(n, y) option remember; `if`(y<0 or y>n, 0,
`if`(n=0, 1, expand(b(n-1, y)+`if`(n>1, b(n-2, y)+
b(n-2, y+1), 0) +b(n-1, y-1)*`if`(y=1, x, 1))))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
seq(T(n), n=0..20); # Alois P. Heinz, Aug 24 2014
MATHEMATICA
b[n_, y_] := b[n, y] = If[y<0 || y>n, 0, If[n==0, 1, Expand[b[n-1, y] + If[n>1, b[n-2, y] + b[n-2, y+1], 0] + b[n-1, y-1]*If[y==1, x, 1]]]]; 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, Jun 29 2015, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Emeric Deutsch, Aug 23 2014
STATUS
approved