A333107 Total area under all nonnegative lattice paths from (0,0) to (n,0) where the allowed steps at (x,y) are (1,v) with v in {-1,0,...,max(y,1)}.
0, 0, 1, 4, 16, 56, 190, 637, 2131, 7156, 24215, 82758, 285991, 999715, 3534394, 12631420, 45601759, 166169360, 610650687, 2261234467, 8430749631, 31625520000, 119281312293, 452077280484, 1720796968459, 6575385383602, 25212139233077, 96970372087853
Offset: 0
Keywords
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1665
- Wikipedia, Counting lattice paths
- Wikipedia, Motzkin number
Programs
-
Maple
b:= proc(x, y) option remember; `if`(x=0, [1, 0], add( (p-> p+[0, p[1]*(y+j/2)])(b(x-1, y+j)), 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_] := b[x, y] = If[x == 0, {1, 0}, Sum[ Function[p, p + {0, p[[1]]*(y + j/2)}][b[x - 1, y + j]], {j, -Min[1, y], Min[Max[1, y], x - y - 1]}]]; a[n_] := b[n, 0][[2]]; a /@ Range[0, 29] (* Jean-François Alcover, Apr 05 2021, after Alois P. Heinz *)