login
The total number of levels visited by all Motzkin paths of length n.
2

%I #13 Apr 16 2024 19:05:17

%S 1,1,3,7,18,46,121,323,875,2395,6611,18371,51337,144145,406420,

%T 1150126,3265412,9298372,26547710,75978322,217921336,626287520,

%U 1803176384,5200298000,15020569818,43447201226,125837214564,364911724264,1059404265599,3078918594707

%N The total number of levels visited by all Motzkin paths of length n.

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

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

%F a(n) = A001006(n) + A333498(n).

%p b:= proc(x, y, h) option remember; `if`(x=0, h+1, add(

%p b(x-1, y+j, max(h, y)), j=-min(1, y)..min(1, x-y-1)))

%p end:

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

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

%Y Row sums of A372014.

%Y Cf. A001006, A261003, A333498.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Apr 16 2024