A247292 Triangle read by rows: T(n,k) is the number of weighted lattice paths B(n) having k uHd strings.
1, 1, 2, 4, 8, 16, 1, 35, 2, 77, 5, 172, 13, 391, 32, 899, 78, 1, 2085, 195, 3, 4877, 487, 9, 11490, 1217, 28, 27236, 3055, 81, 64916, 7687, 228, 1, 155483, 19374, 641, 4, 374027, 48925, 1782, 14, 903286, 123760, 4908, 50, 2189219, 313512, 13451, 165, 5322965, 795263, 36690, 522, 1
Offset: 0
Examples
T(6,1)=2 because we have uHdh and huHd. Triangle starts: 1; 1; 2; 4; 8; 16,1; 35,2;
Links
- Alois P. Heinz, Rows n = 0..320, 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-z^2+t*z^2)*G: G := RootOf(eq, G): Gser := simplify(series(G, z = 0, 25)): for n from 0 to 22 do P[n] := sort(coeff(Gser, z, n)) end do; for n from 0 to 22 do seq(coeff(P[n], t, k), k = 0 .. floor((1/5)*n)) 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, 0)+`if`(n>1, b(n-2, y, `if`(t=1, 2, 0))+ b(n-2, y+1, 1), 0)+b(n-1, y-1, 0)*`if`(t=2, x, 1)))) end: T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2)): seq(T(n), n=0..20); # Alois P. Heinz, Sep 16 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, 0] + If[n>1, b[n-2, y, If[t == 1, 2, 0]] + b[n-2, y+1, 1], 0] + b[n-1, y-1, 0]*If[t == 2, x, 1]]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0, 0]]; Table[T[n], {n, 0, 20}] // Flatten (* Jean-François Alcover, May 27 2015, after Alois P. Heinz *)
Formula
G.f. G = G(t,z) satisfies G = 1 + z*G + z^2*G + z^3*G*(G - z^2 + t*z^2).
Comments