%I #22 Jan 05 2019 14:51:14
%S 1,1,1,1,1,2,1,1,2,2,1,1,2,4,3,1,1,2,4,6,2,1,1,2,4,8,11,4,1,1,2,4,8,
%T 14,15,2,1,1,2,4,8,16,27,27,4,1,1,2,4,8,16,30,47,39,3,1,1,2,4,8,16,32,
%U 59,88,63,4,1,1,2,4,8,16,32,62,111,158,100,2
%N Number A(n,k) of compositions of n where the difference between largest and smallest parts is <= k; square array A(n,k), n>=0, k>=0, read by antidiagonals.
%H Alois P. Heinz, <a href="/A214257/b214257.txt">Antidiagonals n = 0..150, flattened</a>
%F T(n,k) = Sum_{i=0..k} A214258(n,i).
%e A(3,0) = 2: [3], [1,1,1].
%e A(4,1) = 6: [4], [2,2], [2,1,1], [1,2,1], [1,1,2], [1,1,1,1].
%e A(5,1) = 8: [5], [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], [1,1,1,1,1],
%e A(5,2) = 14: [5], [3,2], [3,1,1], [2,3], [2,2,1], [2,1,2], [2,1,1,1], [1,3,1], [1,2,2], [1,2,1,1], [1,1,3], [1,1,2,1], [1,1,1,2], [1,1,1,1,1].
%e Square array A(n,k) begins:
%e 1, 1, 1, 1, 1, 1, 1, 1, ...
%e 1, 1, 1, 1, 1, 1, 1, 1, ...
%e 2, 2, 2, 2, 2, 2, 2, 2, ...
%e 2, 4, 4, 4, 4, 4, 4, 4, ...
%e 3, 6, 8, 8, 8, 8, 8, 8, ...
%e 2, 11, 14, 16, 16, 16, 16, 16, ...
%e 4, 15, 27, 30, 32, 32, 32, 32, ...
%e 2, 27, 47, 59, 62, 64, 64, 64, ...
%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:= (n, k)-> `if`(n=0, 1, add(b(n-j, k+1, j, j), j=1..n)):
%p seq(seq(A(n, d-n), n=0..d), d=0..11);
%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, k)-> coeff(b(n$2, 0), x, k):
%p A:= proc(n, k) option remember; `if`(k<0, 0,
%p `if`(k>n, A(n$2), A(n, k-1)+T(n, k)))
%p end:
%p seq(seq(A(n, d-n), n=0..d), d=0..11); # _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_] := If[n == 0, 1, Sum[b[n - j, k + 1, j, j], {j, 1, n}]]; Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 11}] // Flatten (* _Jean-François Alcover_, Dec 27 2013, translated from Maple *)
%Y Columns k=0-1 give: A000005, A072951.
%Y Main diagonal gives: A011782.
%Y Cf. A214246, A214247, A214248, A214249, A214258, A214268, A214269.
%K nonn,tabl
%O 0,6
%A _Alois P. Heinz_, Jul 08 2012