OFFSET
0,5
COMMENTS
A Dyck path of semilength n is a (x,y)-lattice path from (0,0) to (2n,0) that does not go below the x-axis and consists of steps U=(1,1) and D=(1,-1). A peak of a Dyck path is any lattice point visited between two consecutive steps UD.
LINKS
Alois P. Heinz, Antidiagonals n = 0..140, flattened
Wikipedia, Lattice path
FORMULA
A(n,k) = Sum_{i=0..min(n,k)} C(k,i) * i! * A258223(n,i).
EXAMPLE
Square array A(n,k) begins:
: 1, 1, 1, 1, 1, 1, ...
: 1, 2, 3, 4, 5, 6, ...
: 2, 10, 24, 44, 70, 102, ...
: 5, 74, 297, 764, 1565, 2790, ...
: 14, 706, 4896, 17924, 47650, 104454, ...
: 42, 8162, 100278, 527844, 1831250, 4953222, ...
MAPLE
b:= proc(x, y, t, k) option remember; `if`(y>x or y<0, 0,
`if`(x=0, 1, b(x-1, y-1, false, k)*`if`(t, (k*x+y)/y, 1)
+ b(x-1, y+1, true, k) ))
end:
A:= (n, k)-> b(2*n, 0, false, k):
seq(seq(A(n, d-n), n=0..d), d=0..12);
MATHEMATICA
b[x_, y_, t_, k_] := b[x, y, t, k] = If[y > x || y < 0, 0, If[x == 0, 1, b[x - 1, y - 1, False, k]*If[t, (k*x + y)/y, 1] + b[x - 1, y + 1, True, k]]];
A [n_, k_] := b[2*n, 0, False, k];
Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 12}] // Flatten (* Jean-François Alcover, Apr 23 2016, translated from Maple *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, May 23 2015
STATUS
approved