A225041
Number of lattice paths from (0,0) to (n,0) that do not go below the x-axis or above the diagonal x=y and consist of steps U=(1,1), D=(1,-1), H=(1,0) and S=(0,1).
Original entry on oeis.org
1, 1, 3, 9, 35, 145, 659, 3137, 15619, 80177, 422595, 2273633, 12447667, 69138193, 388784259, 2209440945, 12671782579, 73260414481, 426545078627, 2499059841249, 14723542302627, 87181150961361, 518554078448339, 3097007445391441, 18565515801339827
Offset: 0
a(0) = 1: the empty path.
a(1) = 1: H.
a(2) = 3: HH, UD, HSD.
a(3) = 9: HHH, UDH, HSDH, UHD, HSHD, HUD, HHSD, UDSD, HSDSD.
-
b:= proc(x, y) option remember; `if`(y>x, 0, `if`(x=0, 1,
b(x-1, y)+`if`(y>0, b(x-1, y-1)+b(x, y-1), 0)+b(x-1, y+1)))
end:
a:= n-> b(n, 0):
seq(a(n), n=0..25);
-
b[x_, y_] := b[x, y] = If[y>x, 0, If[x==0, 1, b[x-1, y]+If[y>0, b[x-1, y-1] + b[x, y-1], 0] + b[x-1, y+1]]];
a[n_] := b[n, 0];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Mar 29 2017, translated from Maple *)
A224776
Number of lattice paths from (0,0) to (n,n) that do not go below the x-axis or above the diagonal x=y and consist of steps D=(1,-1), H=(1,0) and S=(0,1).
Original entry on oeis.org
1, 1, 3, 14, 83, 568, 4271, 34296, 288946, 2524676, 22695611, 208713400, 1955285936, 18601484936, 179267898087, 1746795785272, 17183086302528, 170427862676296, 1702621483524154, 17118538010217472, 173092651634957516, 1759113081143064184, 17959329720442879275
Offset: 0
a(0) = 1: the empty path.
a(1) = 1: HS.
a(2) = 3: HSHS, HHSS, HSDSS.
a(3) = 14: HSHSHS, HHSSHS, HSDSSHS, HSHHSS, HHSHSS, HSDSHSS, HHHSSS, HSDHSSS, HSHDSSS, HHSDSSS, HSDSDSSS, HSHSDSS, HHSSDSS, HSDSSDSS.
-
b:= proc(x, y) option remember; `if`(y>x, 0, `if`(x=0, 1,
b(x-1, y)+`if`(y>0, b(x, y-1), 0)+b(x-1, y+1)))
end:
a:= n-> b(n, n):
seq(a(n), n=0..25);
-
b[x_, y_] := b[x, y] = If[y > x, 0, If[x == 0, 1, b[x - 1, y] + If[y > 0, b[x, y - 1], 0] + b[x - 1, y + 1]]];
a[n_] := b[n, n];
a /@ Range[0, 25] (* Jean-François Alcover, Dec 18 2020, after Alois P. Heinz *)
A286761
Total number of nodes summed over all lattice paths from (0,0) to (n,0) that do not go below the x-axis or above the diagonal x=y and consist of steps D=(1,-1), H=(1,0) and S=(0,1).
Original entry on oeis.org
1, 2, 7, 25, 106, 470, 2218, 10799, 54158, 277089, 1441956, 7602630, 40524952, 217954222, 1181107568, 6441519814, 35323986620, 194629681327, 1076819450324, 5979314763974, 33308210757892, 186074808452033, 1042146006514656, 5850075202736100, 32907053660222560
Offset: 0
-
b:= proc(x, y) option remember; `if`(y<0 or y>x, 0, `if`(x=0, [1$2],
(p-> p+[0, p[1]])(b(x-1, y)+b(x, y-1)+b(x-1, y+1))))
end:
a:= n-> b(n, 0)[2]:
seq(a(n), n=0..30);
-
b[x_, y_] := b[x, y] = If[y < 0 || y > x, 0, If[x == 0, {1, 1}, Function[
p, p + {0, p[[1]]}][b[x - 1, y] + b[x, y - 1] + b[x - 1, y + 1]]]];
a[n_] := b[n, 0][[2]];
Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Jun 28 2022, after Alois P. Heinz *)
Showing 1-3 of 3 results.