OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Wikipedia, Counting lattice paths
EXAMPLE
. a(3) = 2: /\ /\
. /\/ \ / \/\ .
.
. a(4) = 5: /\ /\ /\/\ /\ /\/\
. /\/\/ \ /\/ \/\ /\/ \ / \/\/\ / \/\ .
MAPLE
b:= proc(n, j) option remember; `if`(n=j, 1, add(
b(n-j, i)*i*(binomial(j-1, i-2) +(i-1)/2*
binomial(j-1, i-3)), i=2..min(j+3, n-j)))
end:
a:= n-> `if`(n=0, 1, b(n, 1)+b(n, 2)):
seq(a(n), n=0..35);
MATHEMATICA
b[n_, j_] := b[n, j] = If[n == j, 1, Sum[b[n - j, i]*i*(Binomial[j - 1, i - 2] + (i - 1)/2*Binomial[j - 1, i - 3]), {i, 2, Min[j + 3, n - j]}]];
a[n_] := If[n == 0, 1, b[n, 1] + b[n, 2]];
Table[a[n], {n, 0, 35}] (* Jean-François Alcover, May 29 2018, from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 03 2017
STATUS
approved