%I #16 Jul 23 2017 12:16:15
%S 1,1,2,1,5,4,1,14,14,7,1,41,51,33,11,1,124,188,145,69,16,1,386,690,
%T 627,362,131,22,1,1230,2529,2655,1790,821,230,29,1,3992,9283,11033,
%U 8533,4610,1719,379,37,1,13150,34135,45257,39435,24434,10957,3361,593,46,1
%N Triangle read by rows: T(n,k) is the number of skew Dyck paths of semilength n having k DD's (0 <= k <= n-1 for n >= 1).
%C A skew Dyck path is a path in the first quadrant which begins at the origin, ends on the x-axis, consists of steps U=(1,1)(up), D=(1,-1)(down) and L=(-1,-1)(left) so that up and left steps do not overlap. The length of the path is defined to be the number of its steps.
%C Row n has n terms (n >= 1).
%C Row sums yield the sequence A002212.
%H Alois P. Heinz, <a href="/A128738/b128738.txt">Rows n = 0..150, flattened</a>
%H E. Deutsch, E. Munarini, S. Rinaldi, <a href="http://dx.doi.org/10.1016/j.jspi.2010.01.015">Skew Dyck paths</a>, J. Stat. Plann. Infer. 140 (8) (2010) 2191-2203
%F T(n,0) = A128739(n).
%F Sum_{k=0..n-1} k*T(n,k) = A128740(n).
%F G.f.: G = G(t,z) satisfies z^2*G^3 - z(1-t)(1-z)G^2 - (1-z)(1 - 3z + tz)G + (1-z)^2 = 0.
%e T(3,1)=4 because we have UDUUDD, UUDDUD, UUDUDD and UUUDDL.
%e Triangle starts:
%e 1;
%e 1;
%e 2, 1;
%e 5, 4, 1;
%e 14, 14, 7, 1;
%e 41, 51, 33, 11, 1;
%p eq:=z^2*G^3-z*(1-z)*(1-t)*G^2-(1-z)*(1-3*z+z*t)*G+(1-z)^2=0: G:=RootOf(eq,G): Gser:=simplify(series(G,z=0,15)): for n from 0 to 11 do P[n]:=sort(expand(coeff(Gser,z,n))) od: for n from 0 to 11 do seq(coeff(P[n],t,j),j=0..n-1) od; # yields sequence in triangular form
%p # second Maple program:
%p b:= proc(n, y, t) option remember; expand(`if`(y>n, 0, `if`(n=0, 1,
%p `if`(t<0, 0, b(n-1, y+1, 1))+`if`(y<1, 0, b(n-1, y-1, 0)*
%p `if`(t=0, z, 1))+`if`(t>0 or y<1, 0, b(n-1, y-1, -1)))))
%p end:
%p T:= n-> (p-> seq(coeff(p, z, i), i=0..degree(p)))(b(2*n, 0$2)):
%p seq(T(n), n=0..14); # _Alois P. Heinz_, Jun 19 2016
%t b[n_, y_, t_] := b[n, y, t] = Expand[If[y > n, 0, If[n == 0, 1, If[t < 0, 0, b[n - 1, y + 1, 1]] + If[y < 1, 0, b[n - 1, y - 1, 0]*If[t == 0, z, 1]] + If[t > 0 || y < 1, 0, b[n - 1, y - 1, -1]]]]]; T[n_] := Function [p, Table[Coefficient[p, z, i], {i, 0, Exponent[p, z]}]][b[2*n, 0, 0]]; Table[T[n], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, Dec 20 2016, after _Alois P. Heinz_ *)
%Y Cf. A002212, A128739, A128740.
%K nonn,tabf
%O 0,3
%A _Emeric Deutsch_, Mar 31 2007