OFFSET
0,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1668
Wikipedia, Counting lattice paths
Wikipedia, Motzkin number
FORMULA
a(n) ~ c * 4^n / sqrt(n), where c = 0.0019335749177095597674777855613451543338378695415042866523284... - Vaclav Kotesovec, Oct 24 2021
MAPLE
b:= proc(x, y) option remember; `if`(x=0, 1, add(
b(x-1, y+j), j=-min(1, y)..min(max(1, y), x-y-1)))
end:
a:= n-> (n+1)*b(n, 0):
seq(a(n), n=0..29);
MATHEMATICA
b[x_, y_] := b[x, y] = If[x == 0, 1,
Sum[b[x-1, y+j], {j, -Min[1, y], Min[Max[1, y], x-y-1]}]];
a[n_] := (n+1) b[n, 0];
a /@ Range[0, 29] (* Jean-François Alcover, Apr 05 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Mar 07 2020
STATUS
approved