Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #21 Apr 04 2022 16:49:50
%S 0,1,3,11,40,148,555,2100,7997,30605,117602,453421,1753176,6795248,
%T 26393431,102702230,400277998,1562292741,6105426033,23887275883,
%U 93554945414,366754396228,1438986625349,5650409534767,22203298031827,87306238753663,343511939707274
%N Total sum of the left-to-right strict peak maxima in all Dyck paths of semilength n.
%C Sum of all peak heights in Dyck paths of semilength n is A000302(n-1) for n>0.
%C Sum of all heights in Dyck paths of semilength n is A008549(n).
%H Alois P. Heinz, <a href="/A346194/b346194.txt">Table of n, a(n) for n = 0..650</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Lattice_path#Counting_lattice_paths">Counting lattice paths</a>
%e a(3) = 1 + (1+2) + 2 + 2 + 3 = 11:
%e /\
%e /\ /\ /\/\ / \
%e /\/\/\ /\/ \ / \/\ / \ / \ .
%p b:= proc(x, y, t, h) option remember; `if`(x=0, [1, 0], `if`(y>0,
%p (p-> p+[0, `if`(t=1, p[1]*h, 0)])(b(x-1, y-1, 0, h)), 0)+
%p `if`(y<x-1, b(x-1, y+1, `if`(y+1>h, 1, 0), max(h, y+1)), 0))
%p end:
%p a:= n-> b(2*n, 0$3)[2]:
%p seq(a(n), n=0..32);
%t b[x_, y_, t_, h_] := b[x, y, t, h] = If[x == 0, {1, 0}, If[y > 0,
%t With[{p = b[x-1, y-1, 0, h]}, p+{0, If[t == 1, p[[1]]*h, 0]}]], {0, 0}]+
%t If[y < x - 1, b[x-1, y+1, If[y+1 > h, 1, 0], Max[h, y+1]], {0, 0}] /.
%t Null -> 0;
%t a[n_] := b[2*n, 0, 0, 0][[2]];
%t Table[a[n], {n, 0, 32}] (* _Jean-François Alcover_, Apr 04 2022, after _Alois P. Heinz_ *)
%Y Cf. A000108, A000302, A008549, A346157, A346195.
%K nonn
%O 0,3
%A _Alois P. Heinz_, Jul 09 2021