login
Number of Dyck paths of semilength n such that neighboring peaks differ in height by at most one and first and last peak are at height one.
2

%I #21 Apr 25 2024 09:11:21

%S 1,1,1,1,2,4,8,17,39,93,227,567,1447,3760,9917,26492,71567,195256,

%T 537397,1490614,4163508,11702411,33078992,93986117,268294604,

%U 769171970,2213834911,6395017291,18534987580,53887644375,157121564325,459351495858,1346290327899

%N Number of Dyck paths of semilength n such that neighboring peaks differ in height by at most one and first and last peak are at height one.

%H Alois P. Heinz, <a href="/A371726/b371726.txt">Table of n, a(n) for n = 0..2031</a>

%H Alois P. Heinz, <a href="/A371726/a371726.gif">Animation of a(9)=93 paths</a>

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

%e a(4) = 2: /\

%e /\/\/\/\ /\/ \/\ .

%p b:= proc(x, y, h, t) option remember; `if`(y<0 or y>x, 0,

%p `if`(x=0, `if`(h>1, 0, 1), `if`(t=1 and abs(y-h)>1, 0,

%p b(x-1, y-1, `if`(t=1, y, h), 0))+b(x-1, y+1, h, 1)))

%p end:

%p a:= n-> b(2*n, 0$3):

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

%Y Cf. A000108, A287776, A371705, A371727.

%K nonn

%O 0,5

%A _Alois P. Heinz_, Apr 04 2024