%I #34 Sep 26 2023 11:34:19
%S 1,1,0,2,0,0,3,1,0,0,5,5,0,0,0,7,16,3,0,0,0,11,43,21,1,0,0,0,15,99,
%T 101,17,0,0,0,0,22,215,373,145,9,0,0,0,0,30,430,1174,836,146,4,0,0,0,
%U 0,42,834,3337,3846,1324,112,1,0,0,0,0,56,1529,8642,15002,8786,1615,66,0,0,0,0,0,77,2765,21148,52132,47013,15403,1582,32,0,0,0,0,0
%N Triangle read by rows: T(n,k) gives the number of ballot sequences of length n having exactly k descents, n>=0, 0<=k<=n.
%C Also number of standard Young tableaux such that there are k pairs of cells (v,v+1) with v+1 lying in a row above v.
%C Columns k=0-10 give: A000041, A241794, A241795, A241796, A241797, A241798, A241799, A241800, A241801, A241802, A241803.
%C T(2n,n) gives A241804.
%C T(2n+1,n) gives A241805.
%C Row sums are A000085.
%C T(n*(n+1)/2,n*(n-1)/2) = 1.
%C A238122 is another version with zeros omitted.
%H Joerg Arndt and Alois P. Heinz, <a href="/A238121/b238121.txt">Rows n = 0..50, flattened</a>
%e Triangle starts:
%e 1;
%e 1, 0;
%e 2, 0, 0;
%e 3, 1, 0, 0;
%e 5, 5, 0, 0, 0;
%e 7, 16, 3, 0, 0, 0;
%e 11, 43, 21, 1, 0, 0, 0;
%e 15, 99, 101, 17, 0, 0, 0, 0;
%e 22, 215, 373, 145, 9, 0, 0, 0, 0;
%e 30, 430, 1174, 836, 146, 4, 0, 0, 0, 0;
%e 42, 834, 3337, 3846, 1324, 112, 1, 0, 0, 0, 0;
%e 56, 1529, 8642, 15002, 8786, 1615, 66, 0, 0, 0, 0, 0;
%e 77, 2765, 21148, 52132, 47013, 15403, 1582, 32, 0, 0, 0, 0, 0;
%e 101, 4792, 48713, 164576, 214997, 112106, 21895, 1310, 14, 0, 0, 0, 0, 0;
%e ...
%e The T(5,1) = 16 ballot sequences of length n=5 with k=1 descent are (dots for zeros):
%e 01: [ . . . 1 . ]
%e 02: [ . . 1 . . ]
%e 03: [ . . 1 . 1 ]
%e 04: [ . . 1 . 2 ]
%e 05: [ . . 1 1 . ]
%e 06: [ . . 1 2 . ]
%e 07: [ . . 1 2 1 ]
%e 08: [ . 1 . . . ]
%e 09: [ . 1 . . 1 ]
%e 10: [ . 1 . . 2 ]
%e 11: [ . 1 . 1 2 ]
%e 12: [ . 1 . 2 3 ]
%e 13: [ . 1 2 . . ]
%e 14: [ . 1 2 . 1 ]
%e 15: [ . 1 2 . 3 ]
%e 16: [ . 1 2 3 . ]
%p b:= proc(n, v, l) option remember; `if`(n<1, 1, expand(
%p add(`if`(i=1 or l[i-1]>l[i], `if`(i<v, x, 1)*
%p b(n-1, i, subsop(i=l[i]+1, l)), 0), i=1..nops(l))+
%p b(n-1, nops(l)+1, [l[], 1])))
%p end:
%p T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b(n-1, 1, [1])):
%p seq(T(n), n=0..14);
%t b[n_, v_, l_] := b[n, v, l] = If[n<1, 1, Sum[If[i == 1 || l[[i-1]] > l[[i]], If[i<v, x, 1]*b[n-1, i, ReplacePart[l, i -> l[[i]]+1]], 0], {i, 1, Length[l]}] + b[n-1, Length[l]+1, Append[l, 1]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, n}]][b[n-1, 1, {1}]]; Table[T[n], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, Jan 06 2015, translated from Maple *)
%K nonn,tabl
%O 0,4
%A _Joerg Arndt_ and _Alois P. Heinz_, Feb 21 2014