OFFSET
0,6
LINKS
Alois P. Heinz, Antidiagonals n = 0..140, flattened
Wikipedia, Motzkin number
FORMULA
A(n,k) = Sum_{i=0..min(floor(n/2),k)} C(k,i) * i! * A258310(n,i).
EXAMPLE
Square array A(n,k) begins:
: 1, 1, 1, 1, 1, 1, 1, ...
: 1, 1, 1, 1, 1, 1, 1, ...
: 2, 3, 4, 5, 6, 7, 8, ...
: 4, 7, 10, 13, 16, 19, 22, ...
: 9, 23, 43, 69, 101, 139, 183, ...
: 21, 71, 151, 261, 401, 571, 771, ...
: 51, 255, 703, 1485, 2691, 4411, 6735, ...
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, false, k) +b(x-1, y+1, true, k)))
end:
A:= (n, k)-> b(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, False, k] + b[x - 1, y + 1, True, k]]];
A[n_, k_] := b[n, 0, False, k];
Table[A[n, d - n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, May 04 2017, translated from Maple *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, May 25 2015
STATUS
approved