login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number A(n,k) of compositions of n where differences between neighboring parts are in {-k,0,k}; square array A(n,k), n>=0, k>=0, read by antidiagonals.
10

%I #20 Dec 31 2018 07:30:39

%S 1,1,1,1,1,2,1,1,2,2,1,1,2,4,3,1,1,2,2,6,2,1,1,2,2,5,11,4,1,1,2,2,3,5,

%T 17,2,1,1,2,2,3,4,10,29,4,1,1,2,2,3,2,7,10,47,3,1,1,2,2,3,2,6,8,21,78,

%U 4,1,1,2,2,3,2,4,5,9,22,130,2

%N Number A(n,k) of compositions of n where differences between neighboring parts are in {-k,0,k}; square array A(n,k), n>=0, k>=0, read by antidiagonals.

%H Alois P. Heinz, <a href="/A214246/b214246.txt">Antidiagonals n = 0..140, flattened</a>

%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,2) = 5: [5], [3,1,1], [1,3,1], [1,1,3], [1,1,1,1,1].

%e A(6,3) = 7: [6], [4,1,1], [3,3], [2,2,2], [1,4,1], [1,1,4], [1,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, 2, 2, 2, 2, 2, 2, ...

%e 3, 6, 5, 3, 3, 3, 3, 3, ...

%e 2, 11, 5, 4, 2, 2, 2, 2, ...

%e 4, 17, 10, 7, 6, 4, 4, 4, ...

%e 2, 29, 10, 8, 5, 4, 2, 2, ...

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

%p `if`(n<1 or i<1, 0, `if`(n=i, 1, add(b(n-i, i+j, k), j={-k, 0, k})))

%p end:

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

%p seq(seq(A(n, d-n), n=0..d), d=0..15);

%t b[n_, i_, k_] := b[n, i, k] = If[n < 1 || i < 1, 0, If[n == i, 1, Sum[b[n - i, i + j, k], {j, Union[{-k, 0, k}]}]]]; A[n_, k_] := If[n == 0, 1, Sum[b[n, j, k], {j, 1, n}]]; Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 15}] // Flatten (* _Jean-François Alcover_, Dec 27 2013, translated from Maple *)

%Y Column k=0 and main diagonal give: A000005.

%Y Columns k=1, 2 give: A034297, A214253.

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

%K nonn,tabl

%O 0,6

%A _Alois P. Heinz_, Jul 08 2012