OFFSET
0,5
COMMENTS
The maximal height in all paths of length n is floor(ceil(n/2)^2/4) = A008642(n-3) for n>2.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..100
Alois P. Heinz, Animation of A333647(9) = 169 paths with height sum a(9) = 375
Wikipedia, Counting lattice paths
MAPLE
b:= proc(x, y, t, h) option remember;
`if`(x=0, h, add(b(x-1, y+j, j, max(h, y)),
j=max(t-1, -y)..min(x*(x-1)/2-y, t+1)))
end:
a:= n-> b(n, 0$3):
seq(a(n), n=0..32);
MATHEMATICA
b[x_, y_, t_, h_] := b[x, y, t, h] =
If[x == 0, h, Sum[b[x - 1, y + j, j, Max[h, y]],
{j, Max[t - 1, -y], Min[x(x - 1)/2 - y, t + 1]}]];
a[n_] := b[n, 0, 0, 0];
a /@ Range[0, 32] (* Jean-François Alcover, Apr 26 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 01 2020
STATUS
approved