A357655 Total number of nodes summed over all lattice paths from (0,0) to (i,n-2*i) that do not go above the diagonal x=y using steps in {(1,0), (0,1)}.
1, 0, 2, 3, 3, 8, 14, 15, 35, 59, 69, 147, 245, 300, 608, 1005, 1269, 2489, 4091, 5280, 10120, 16565, 21735, 40950, 66820, 88815, 165125, 268785, 361005, 664108, 1078904, 1461609, 2665617, 4323643, 5899917, 10682712, 17304516, 23759955, 42759385, 69187281
Offset: 0
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..2500
- Wikipedia, Counting lattice paths
Crossrefs
Cf. A357654.
Programs
-
Maple
b:= proc(x, y) option remember; `if`(min(x, y)<0 or y>x, 0, `if`( max(x, y)=0, [1$2], (p-> p+[0, p[1]])(b(x-1, y)+b(x, y-1)))) end: a:= n-> add(b(i, n-2*i), i=ceil(n/3)..floor(n/2))[2]: seq(a(n), n=0..39);
-
Mathematica
b[x_, y_] := b[x, y] = If[Min[x, y] < 0 || y > x, {0, 0}, If[Max[x, y] == 0, {1, 1}, Function[p, p + {0, p[[1]]}][b[x - 1, y] + b[x, y - 1]]]]; a[n_] := If[n == 1, 0, Sum[b[i, n - 2i], {i, Ceiling[n/3], Floor[n/2]}][[2]]]; Table[a[n], {n, 0, 39}] (* Jean-François Alcover, May 27 2023, after Alois P. Heinz *)