A072705 Triangle of number of unimodal compositions of n into exactly k distinct terms.
1, 1, 0, 1, 2, 0, 1, 2, 0, 0, 1, 4, 0, 0, 0, 1, 4, 4, 0, 0, 0, 1, 6, 4, 0, 0, 0, 0, 1, 6, 8, 0, 0, 0, 0, 0, 1, 8, 12, 0, 0, 0, 0, 0, 0, 1, 8, 16, 8, 0, 0, 0, 0, 0, 0, 1, 10, 20, 8, 0, 0, 0, 0, 0, 0, 0, 1, 10, 28, 16, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 32, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 40, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1
Examples
Rows start: 1; 1,0; 1,2,0; 1,2,0,0; 1,4,0,0,0; 1,4,4,0,0,0; 1,6,4,0,0,0,0; 1,6,8,0,0,0,0,0; etc. T(6,3)=4 since 6 can be written as 1+2+3, 1+3+2, 2+3+1, or 3+2+1 but not 2+1+3 or 3+1+2. From _Gus Wiseman_, Mar 06 2020: (Start) Triangle begins: 1 1 0 1 2 0 1 2 0 0 1 4 0 0 0 1 4 4 0 0 0 1 6 4 0 0 0 0 1 6 8 0 0 0 0 0 1 8 12 0 0 0 0 0 0 1 8 16 8 0 0 0 0 0 0 1 10 20 8 0 0 0 0 0 0 0 1 10 28 16 0 0 0 0 0 0 0 0 1 12 32 24 0 0 0 0 0 0 0 0 0 1 12 40 40 0 0 0 0 0 0 0 0 0 0 1 14 48 48 16 0 0 0 0 0 0 0 0 0 0 (End)
Links
- Alois P. Heinz, Rows n = 1..141, flattened
Crossrefs
Column k = 2 is A052928.
Unimodal compositions are A001523.
Unimodal sequences covering an initial interval are A007052.
Strict compositions are A032020.
Non-unimodal strict compositions are A072707.
Unimodal compositions covering an initial interval are A227038.
Numbers whose prime signature is not unimodal are A332282.
Programs
-
Maple
b:= proc(n, i) option remember; `if`(n>i*(i+1)/2, 0, `if`(n=0, 1, expand(b(n, i-1) +`if`(i>n, 0, x*b(n-i, i-1))))) end: T:= n-> (p-> seq(coeff(p, x, i)*ceil(2^(i-1)), i=1..n))(b(n$2)): seq(T(n), n=1..14); # Alois P. Heinz, Mar 26 2014
-
Mathematica
b[n_, i_] := b[n, i] = If[n > i*(i+1)/2, 0, If[n == 0, 1, Expand[b[n, i-1] + If[i > n, 0, x*b[n-i, i-1]]]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i]* Ceiling[2^(i-1)], {i, 1, n}]][b[n, n]]; Table[T[n], {n, 1, 14}] // Flatten (* Jean-François Alcover, Feb 26 2015, after Alois P. Heinz *) unimodQ[q_]:=Or[Length[q]<=1,If[q[[1]]<=q[[2]],unimodQ[Rest[q]],OrderedQ[Reverse[q]]]]; Table[Length[Select[Join@@Permutations/@IntegerPartitions[n,{k}],UnsameQ@@#&&unimodQ[#]&]],{n,12},{k,n}] (* Gus Wiseman, Mar 06 2020 *)
Formula
T(n,k) = 2^(k-1)*A060016(n,k) = T(n-k,k)+2*T(n-k,k-1) [starting with T(0,0)=0, T(0,1)=0 and T(n,1)=1 for n>0].
Comments