A246179 Triangle read by rows: T(n,k) is the number of weighted lattice paths in B(n) having k returns to the horizontal axis (i.e., (1,-1)-steps ending on the horizontal axis). The members of B(n) are paths of weight n that start in (0,0), end on but never go below the horizontal axis, and whose steps are of the following four kinds: a (1,0)-step with weight 1; a (1,0)-step with weight 2; a (1,1)-step with weight 2; a (1,-1)-step with weight 1. The weight of a path is the sum of the weights of its steps.
1, 1, 2, 3, 1, 5, 3, 8, 9, 13, 23, 1, 21, 56, 5, 34, 131, 20, 55, 300, 67, 1, 89, 678, 204, 7, 144, 1523, 581, 35, 233, 3416, 1580, 143, 1, 377, 7677, 4155, 517, 9, 610, 17329, 10663, 1716, 54, 987, 39353, 26880, 5352, 259, 1, 1597, 90000, 66891, 15924, 1079
Offset: 0
Examples
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;
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.
Programs
-
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 *)
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.
Comments