login

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”).

Number of Dyck paths of semilength n such that the maximal number of peaks per level equals seven.
2

%I #13 Apr 24 2021 08:45:18

%S 1,1,17,71,368,1697,7769,34751,153313,668088,2882104,12329145,

%T 52358300,220901081,926638057,3867432363,16068748557,66495876593,

%U 274178902925,1126793986670,4616878543095,18864740697016,76885237242318,312611605360287,1268261191750753

%N Number of Dyck paths of semilength n such that the maximal number of peaks per level equals seven.

%H Alois P. Heinz, <a href="/A288748/b288748.txt">Table of n, a(n) for n = 7..1000</a>

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

%p b:= proc(n, k, j) option remember; `if`(j=n, 1, add(

%p b(n-j, k, i)*add(binomial(i, m)*binomial(j-1, i-1-m),

%p m=max(0, i-j)..min(k, i-1)), i=1..min(j+k, n-j)))

%p end:

%p g:= proc(n, k) option remember; add(b(n, k, j), j=1..k) end:

%p a:= n-> g(n, 7)-g(n, 6):

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

%t b[n_, k_, j_]:=b[n, k, j]=If[j==n, 1, Sum[b[n - j,k, i] Sum[Binomial[i, m] Binomial[j - 1, i - 1 - m], {m, Max[0, i - j], Min[k, i - 1]}], {i, Min[j + k, n - j]}]]; g[n_, k_]:=Sum[b[n, k, j], {j, k}]; Table[g[n, 7] - g[n, 6], {n, 7, 35}] (* _Indranil Ghosh_, Aug 08 2017 *)

%o (Python)

%o from sympy.core.cache import cacheit

%o from sympy import binomial

%o @cacheit

%o def b(n, k, j): return 1 if j==n else sum([b(n - j, k, i)*sum([binomial(i, m)*binomial(j - 1, i - 1 - m) for m in range(max(0, i - j), min(k, i - 1) + 1)]) for i in range(1, min(j + k, n - j) + 1)])

%o def g(n, k): return sum([b(n, k, j) for j in range(1, k + 1)])

%o def a(n): return g(n, 7) - g(n, 6)

%o print([a(n) for n in range(7, 36)]) # _Indranil Ghosh_, Aug 08 2017

%Y Column k=7 of A287822.

%Y Cf. A000108.

%K nonn

%O 7,3

%A _Alois P. Heinz_, Jun 14 2017