OFFSET
0,4
COMMENTS
The maximal height in all paths of length n is A103354(n-1).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..500
Wikipedia, Counting lattice paths
Wikipedia, Motzkin number
MAPLE
b:= proc(x, y, h) option remember;
`if`(x=0, h, add(b(x-1, y+j, max(y, h)),
j=-min(1, y)..min(max(1, y), x-y-1)))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..29);
MATHEMATICA
b[x_, y_, h_] := b[x, y, h] = If[x == 0, h, Sum[b[x - 1, y + j, Max[y, h]], {j, -Min[1, y], Min[Max[1, y], x - y - 1]}]];
a[n_] := b[n, 0, 0];
a /@ Range[0, 29] (* Jean-François Alcover, May 12 2020, after Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Mar 28 2020
STATUS
approved