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”).

A214269
Number T(n,k) of compositions of n where the difference between largest and smallest parts equals k and adjacent parts are unequal; triangle T(n,k), n>=1, 0<=k<n, read by rows.
18
1, 1, 0, 1, 2, 0, 1, 1, 2, 0, 1, 3, 1, 2, 0, 1, 2, 8, 1, 2, 0, 1, 4, 7, 8, 1, 2, 0, 1, 2, 13, 12, 8, 1, 2, 0, 1, 4, 25, 18, 12, 8, 1, 2, 0, 1, 4, 27, 46, 23, 12, 8, 1, 2, 0, 1, 4, 43, 69, 51, 23, 12, 8, 1, 2, 0, 1, 3, 71, 111, 90, 56, 23, 12, 8, 1, 2, 0
OFFSET
1,5
LINKS
FORMULA
T(n,0) = 1, T(n,k) = A214268(n,k) - A214268(n,k-1) for k>0.
EXAMPLE
T(7,0) = 1: [7].
T(7,1) = 4: [4,3], [3,4], [2,3,2], [1,2,1,2,1].
T(7,2) = 7: [3,1,3], [3,1,2,1], [2,1,3,1], [1,3,2,1], [1,3,1,2], [1,2,3,1], [1,2,1,3].
T(7,3) = 8: [5,2], [4,2,1], [4,1,2], [2,5], [2,4,1], [2,1,4], [1,4,2], [1,2,4].
T(7,4) = 1: [1,5,1].
T(7,5) = 2: [6,1], [1,6].
Triangle T(n,k) begins:
1;
1, 0;
1, 2, 0;
1, 1, 2, 0;
1, 3, 1, 2, 0;
1, 2, 8, 1, 2, 0;
1, 4, 7, 8, 1, 2, 0;
1, 2, 13, 12, 8, 1, 2, 0;
MAPLE
b:= proc(n, k, s, t, l) option remember;
`if`(n<0, 0, `if`(n=0, 1, add(`if`(j=l, 0, b(n-j, k,
min(s, j), max(t, j), j)), j=max(1, t-k+1)..s+k-1)))
end:
A:= proc(n, k) option remember;
`if`(n=0, 1, add(b(n-j, k+1, j, j, j), j=1..n))
end:
T:= (n, k)-> A(n, k) -`if`(k=0, 0, A(n, k-1)):
seq(seq(T(n, k), k=0..n-1), n=1..14);
MATHEMATICA
b[n_, k_, s_, t_, l_] := b[n, k, s, t, l] = If[n < 0, 0, If[n == 0, 1, Sum [If[j == l, 0, b[n-j, k, Min[s, j], Max[t, j], 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], {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, 12}] // Flatten (* Jean-François Alcover, Dec 11 2013, translated from Maple *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, Jul 09 2012
STATUS
approved