A288108 Number T(n,k) of Dyck paths of semilength n such that each level has exactly k peaks or no peaks; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
1, 0, 1, 0, 1, 1, 0, 3, 1, 1, 0, 5, 2, 1, 1, 0, 13, 5, 3, 1, 1, 0, 31, 15, 4, 4, 1, 1, 0, 71, 27, 10, 7, 5, 1, 1, 0, 181, 76, 36, 11, 11, 6, 1, 1, 0, 447, 196, 83, 22, 19, 16, 7, 1, 1, 0, 1111, 548, 225, 81, 32, 31, 22, 8, 1, 1, 0, 2799, 1388, 573, 235, 60, 56, 48, 29, 9, 1, 1
Offset: 0
Examples
. T(5,2) = 5: /\/\ . /\ /\ / \ . /\/\ /\/\ /\/\ / \/ \ / \ . /\/\/ \ /\/ \/\ / \/\/\ / \ / \ . . . T(5,3) = 3: . /\/\/\ . /\ /\/\ /\/\ /\ / \ . / \/ \ / \/ \ / \ . . Triangle T(n,k) begins: 1; 0, 1; 0, 1, 1; 0, 3, 1, 1; 0, 5, 2, 1, 1; 0, 13, 5, 3, 1, 1; 0, 31, 15, 4, 4, 1, 1; 0, 71, 27, 10, 7, 5, 1, 1; 0, 181, 76, 36, 11, 11, 6, 1, 1;
Links
- Alois P. Heinz, Rows n = 0..140, flattened
- Wikipedia, Counting lattice paths
Crossrefs
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: T:= (n, k)-> b(n, k$2): seq(seq(T(n, k), k=0..n), n=0..14);
-
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]}]]; T[n_, k_] := b[n, k, k]; Table[T[n, k], {n, 0, 14}, {k, 0, n}] // Flatten (* Jean-François Alcover, May 25 2018, translated from Maple *)
Comments