A333071 Total area under all lattice paths from (0,0) to (n,0) that do not go below the x-axis, and at (x,y) only allow steps (1,v) with v in {-1,0,1,...,y+1}.
0, 0, 1, 4, 16, 63, 239, 895, 3343, 12503, 46905, 176620, 667664, 2533699, 9650737, 36887383, 141448958, 544022417, 2098082719, 8111788699, 31434420426, 122068414186, 474932563378, 1851059631879, 7226108097869, 28250493771358, 110594307388370, 433488248791630
Offset: 0
Keywords
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- Wikipedia, Counting lattice paths
- Wikipedia, Motzkin number
Programs
-
Maple
b:= proc(x, y) option remember; `if`(x=0, [1, 0], add(`if`(x+j>y, (p-> p+[0, p[1]*(y-j/2)])( b(x-1, y-j)), 0), j=-1-y..min(1, y))) end: a:= n-> b(n, 0)[2]: seq(a(n), n=0..30);
-
Mathematica
b[x_, y_] := b[x, y] = If[x == 0, {1, 0}, Sum[If[x + j > y, With[{p = b[x - 1, y - j]}, p + {0, p[[1]] (y - j/2)}], 0], {j, -1 - y, Min[1, y]}]]; a[n_] := b[n, 0][[2]]; a /@ Range[0, 30] (* Jean-François Alcover, Apr 05 2021, after Alois P. Heinz *)