login
Number T(n,k) of compositions of n where the difference between largest and smallest parts equals k; triangle T(n,k), n>=1, 0<=k<n, read by rows.
19

%I #34 Jan 07 2019 16:09:41

%S 1,2,0,2,2,0,3,3,2,0,2,9,3,2,0,4,11,12,3,2,0,2,25,20,12,3,2,0,4,35,49,

%T 23,12,3,2,0,3,60,95,58,23,12,3,2,0,4,96,188,123,61,23,12,3,2,0,2,157,

%U 366,266,132,61,23,12,3,2,0,6,241,714,557,294,135,61,23,12,3,2,0

%N Number T(n,k) of compositions of n where the difference between largest and smallest parts equals k; triangle T(n,k), n>=1, 0<=k<n, read by rows.

%C For fixed k > 0, limit_{n->infinity} T(n,k)^(1/n) = d, where d > 1 is the real root of the equation d^(k+2) - 2*d^(k+1) + 1 = 0. - _Vaclav Kotesovec_, Jan 07 2019

%H Alois P. Heinz, <a href="/A214258/b214258.txt">Rows n = 1..150, flattened</a>

%F T(n,0) = A214257(n,0), T(n,k) = A214257(n,k)-A214257(n,k-1) for k>0.

%e T(4,0) = 3: [4], [2,2], [1,1,1,1].

%e T(5,1) = 9: [3,2], [2,3], [2,2,1], [2,1,2], [2,1,1,1], [1,2,2], [1,2,1,1], [1,1,2,1], [1,1,1,2].

%e T(5,2) = 3: [3,1,1], [1,3,1], [1,1,3].

%e T(5,3) = 2: [4,1], [1,4].

%e T(6,2) = 12: [4,2], [3,2,1], [3,1,2], [3,1,1,1], [2,4], [2,3,1], [2,1,3], [1,3,2], [1,3,1,1], [1,2,3], [1,1,3,1], [1,1,1,3].

%e Triangle T(n,k) begins:

%e 1;

%e 2, 0;

%e 2, 2, 0;

%e 3, 3, 2, 0;

%e 2, 9, 3, 2, 0;

%e 4, 11, 12, 3, 2, 0;

%e 2, 25, 20, 12, 3, 2, 0;

%e 4, 35, 49, 23, 12, 3, 2, 0;

%p b:= proc(n, k, s, t) option remember;

%p `if`(n<0, 0, `if`(n=0, 1, add(b(n-j, k,

%p min(s,j), max(t,j)), j=max(1, t-k+1)..s+k-1)))

%p end:

%p A:= proc(n, k) option remember;

%p `if`(n=0, 1, add(b(n-j, k+1, j, j), j=1..n))

%p end:

%p T:= (n, k)-> A(n, k) -`if`(k=0, 0, A(n, k-1)):

%p seq(seq(T(n,k), k=0..n-1), n=1..15);

%p # second Maple program:

%p b:= proc(n, s, t) option remember; `if`(n=0, x^(t-s),

%p add(b(n-j, min(s, j), max(t, j)), j=1..n))

%p end:

%p T:= n-> (p-> seq(coeff(p, x, i), i=0..n-1))(b(n$2, 0)):

%p seq(T(n), n=1..15); # _Alois P. Heinz_, Jan 05 2019

%t b[n_, k_, s_, t_] := b[n, k, s, t] = If[n < 0, 0, If[n == 0, 1, Sum [b[n-j, k, Min[s, j], Max[t, j]], {j, Max[1, t-k+1], s+k-1}]]]; A[n_, k_] := A[n, k] = If[n == 0, 1, Sum[b[n-j, k+1, j, j], {j, 1, n}]]; T[n_, k_] := A[n, k] - If[k == 0, 0, A[n, k-1]]; Table[Table[T[n, k], {k, 0, n-1}], {n, 1, 15}] // Flatten (* _Jean-François Alcover_, Jan 15 2014, translated from Maple *)

%Y Columns k=0-10 give: A000005, A214259, A323119, A323120, A323121, A323122, A323123, A323124, A323125, A323126, A323127.

%Y Row sums give: A011782.

%Y T(2n,n) gives A323111.

%Y Cf. A214246, A214247, A214248, A214249, A214257, A214268, A214269.

%K nonn,tabl

%O 1,2

%A _Alois P. Heinz_, Jul 08 2012