login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #22 Jan 03 2019 18:00:29

%S 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,

%T 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,

%U 12,8,1,2,0,1,3,71,111,90,56,23,12,8,1,2,0

%N 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.

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

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

%e T(7,0) = 1: [7].

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

%e 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].

%e 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].

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

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

%e Triangle T(n,k) begins:

%e 1;

%e 1, 0;

%e 1, 2, 0;

%e 1, 1, 2, 0;

%e 1, 3, 1, 2, 0;

%e 1, 2, 8, 1, 2, 0;

%e 1, 4, 7, 8, 1, 2, 0;

%e 1, 2, 13, 12, 8, 1, 2, 0;

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

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

%p min(s, j), max(t, j), 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), 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..14);

%t 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 *)

%Y Columns k=0-10 give: A000012, A214270, A214271, A214272, A214273, A214274, A214275, A214276, A214277, A214278, A214279.

%Y Row sums give: A003242.

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

%K nonn,tabl

%O 1,5

%A _Alois P. Heinz_, Jul 09 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 16:28 EDT 2024. Contains 371916 sequences. (Running on oeis4.)