OFFSET
0,3
COMMENTS
A sequence of integers is unimodal if it is the concatenation of a weakly increasing and a weakly decreasing sequence.
A composition of n is a finite sequence of positive integers summing to n.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..500
Eric Weisstein's World of Mathematics, Unimodal Sequence.
FORMULA
a(n) + A332727(n) = 2^(n - 1).
EXAMPLE
The only composition of 6 whose run-lengths are not unimodal is (1,1,2,1,1).
MATHEMATICA
unimodQ[q_]:=Or[Length[q]<=1, If[q[[1]]<=q[[2]], unimodQ[Rest[q]], OrderedQ[Reverse[q]]]]
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], unimodQ[Length/@Split[#]]&]], {n, 0, 10}]
PROG
(PARI)
step(M, m)={my(n=matsize(M)[1]); for(p=m+1, n, my(v=vector((p-1)\m, i, M[p-i*m, i]), s=vecsum(v)); M[p, ]+=vector(#M, i, s-if(i<=#v, v[i]))); M}
desc(M, m)={my(n=matsize(M)[1]); while(m>1, m--; M=step(M, m)); vector(n, i, vecsum(M[i, ]))/(#M-1)}
seq(n)={my(M=matrix(n+1, n+1, i, j, i==1), S=M[, 1]~); for(m=1, n, my(D=M); M=step(M, m); D=(M-D)[m+1..n+1, 1..n-m+2]; S+=concat(vector(m), desc(D, m))); S} \\ Andrew Howroyd, Dec 31 2020
CROSSREFS
Looking at the composition itself (not run-lengths) gives A001523.
The complement is counted by A332727.
Unimodal compositions are A001523.
Unimodal normal sequences appear to be A007052.
Non-unimodal compositions are A115981.
Compositions with normal run-lengths are A329766.
Numbers whose prime signature is not unimodal are A332282.
Partitions whose 0-appended first differences are unimodal are A332283, with complement A332284, with Heinz numbers A332287.
Compositions whose negated run-lengths are unimodal are A332578.
Compositions whose negated run-lengths are not unimodal are A332669.
Compositions whose run-lengths are weakly increasing are A332836.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Feb 29 2020
EXTENSIONS
Terms a(21) and beyond from Andrew Howroyd, Dec 31 2020
STATUS
approved