A262191 Number T(n,k) of compositions of n such that k is the maximal distance between two identical parts; triangle T(n,k), n>=2, 1<=k<=n-1, read by rows.
1, 0, 1, 3, 1, 1, 4, 4, 2, 1, 5, 6, 6, 3, 1, 12, 13, 12, 9, 4, 1, 21, 23, 25, 21, 13, 5, 1, 36, 42, 46, 46, 34, 18, 6, 1, 43, 68, 88, 92, 80, 52, 24, 7, 1, 88, 119, 152, 180, 172, 132, 76, 31, 8, 1, 133, 197, 267, 330, 352, 304, 208, 107, 39, 9, 1
Offset: 2
Examples
T(6,1) = 5: 33, 114, 411, 1122, 2211. T(6,2) = 6: 141, 222, 1113, 1212, 2121, 3111. T(6,3) = 6: 1131, 1221, 1311, 2112, 11112, 21111. T(6,4) = 3: 11121, 11211, 12111. T(6,5) = 1: 111111. Triangle T(n,k) begins: n\k: 1 2 3 4 5 6 7 8 9 10 11 ---+---------------------------------------------------- 02 : 1; 03 : 0, 1; 04 : 3, 1, 1; 05 : 4, 4, 2, 1; 06 : 5, 6, 6, 3, 1; 07 : 12, 13, 12, 9, 4, 1; 08 : 21, 23, 25, 21, 13, 5, 1; 09 : 36, 42, 46, 46, 34, 18, 6, 1; 10 : 43, 68, 88, 92, 80, 52, 24, 7, 1; 11 : 88, 119, 152, 180, 172, 132, 76, 31, 8, 1; 12 : 133, 197, 267, 330, 352, 304, 208, 107, 39, 9, 1;
Links
- Alois P. Heinz, Rows n = 2..20, flattened
Crossrefs
Programs
-
Maple
b:= proc(n, s, l) option remember; `if`(n=0, 1, add( `if`(j in s, 0, b(n-j, s union {`if`(l=[], j, l[1])}, `if`(l=[], [], [subsop(1=NULL, l)[], j]))), j=1..n)) end: T:= (n, k)-> b(n, {}, [0$k]) -b(n, {}, [0$(k-1)]): seq(seq(T(n, k), k=1..n-1), n=2..14);
-
Mathematica
b[n_, s_, l_] := b[n, s, l] = If[n==0, 1, Sum[If[MemberQ[s, j], 0, b[n-j, s ~Union~ {If[l=={}, j, l[[1]]]}, If[l=={}, {}, Append[Rest[l], j]]]], {j, 1, n}]]; T[n_, k_] := b[n, {}, Array[0&, k]] - b[n, {}, Array[0&, k-1]]; Table[T[n, k], {n, 2, 14}, { k, 1, n-1}] // Flatten (* Jean-François Alcover, Feb 08 2017, translated from Maple *)