A288111 Number of Dyck paths of semilength n such that each level has exactly four peaks or no peaks.
1, 0, 0, 0, 1, 1, 4, 7, 11, 22, 81, 235, 673, 2063, 5716, 13627, 33752, 95729, 298232, 946563, 2977953, 9147328, 27004159, 76880498, 217826819, 637089405, 1949908577, 6160707450, 19627448025, 61909478550, 191681762379, 583025396879, 1756696160636
Offset: 0
Keywords
Examples
. a(6) = 4: . /\/\/\/\ . /\ /\/\/\ /\/\ /\/\ /\/\/\ /\ / \ . / \/ \ / \/ \ / \/ \ / \ .
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- Wikipedia, Counting lattice paths
Crossrefs
Column k=4 of A288108.
Programs
-
Maple
b:= proc(n, k, j) option remember; `if`(n=j, 1, add( b(n-j, k, i)*(binomial(j-1, i-1)+binomial(i, k) *binomial(j-1, i-1-k)), i=1..min(j+k, n-j))) end: a:= n-> `if`(n=0, 1, b(n, 4$2)): seq(a(n), n=0..40);
-
Mathematica
b[n_, k_, j_] := b[n, k, j] = If[n == j, 1, Sum[b[n - j, k, i]*(Binomial[j - 1, i - 1] + Binomial[i, k]*Binomial[j - 1, i - 1 - k]), {i, 1, Min[j + k, n - j]}]]; a[n_] := If[n == 0, 1, b[n, 4, 4]]; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jun 02 2018, from Maple *)