[go: up one dir, main page]

login
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}.
5

%I #16 Apr 05 2021 03:56:01

%S 0,0,1,4,16,63,239,895,3343,12503,46905,176620,667664,2533699,9650737,

%T 36887383,141448958,544022417,2098082719,8111788699,31434420426,

%U 122068414186,474932563378,1851059631879,7226108097869,28250493771358,110594307388370,433488248791630

%N 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}.

%H Alois P. Heinz, <a href="/A333071/b333071.txt">Table of n, a(n) for n = 0..1000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Lattice_path#Counting_lattice_paths">Counting lattice paths</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Motzkin_number">Motzkin number</a>

%p b:= proc(x, y) option remember; `if`(x=0, [1, 0],

%p add(`if`(x+j>y, (p-> p+[0, p[1]*(y-j/2)])(

%p b(x-1, y-j)), 0), j=-1-y..min(1, y)))

%p end:

%p a:= n-> b(n, 0)[2]:

%p seq(a(n), n=0..30);

%t b[x_, y_] := b[x, y] = If[x == 0, {1, 0},

%t Sum[If[x + j > y, With[{p = b[x - 1, y - j]}, p +

%t {0, p[[1]] (y - j/2)}], 0], {j, -1 - y, Min[1, y]}]];

%t a[n_] := b[n, 0][[2]];

%t a /@ Range[0, 30] (* _Jean-François Alcover_, Apr 05 2021, after _Alois P. Heinz_ *)

%Y Cf. A333069, A333070, A333107, A333504.

%K nonn

%O 0,4

%A _Alois P. Heinz_, Mar 06 2020