OFFSET
1,3
COMMENTS
The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
A composition is down/up if it is alternately strictly increasing and strictly decreasing, starting with a decrease. For example, the partition (3,2,2,2,1) has no down/up permutations, even though it does have the anti-run permutation (2,1,2,3,2).
LINKS
EXAMPLE
The terms together with the corresponding compositions begin:
0: ()
1: (1)
2: (2)
4: (3)
5: (2,1)
8: (4)
9: (3,1)
16: (5)
17: (4,1)
18: (3,2)
22: (2,1,2)
32: (6)
33: (5,1)
34: (4,2)
38: (3,1,2)
44: (2,1,3)
45: (2,1,2,1)
MATHEMATICA
doupQ[y_]:=And@@Table[If[EvenQ[m], y[[m]]<y[[m+1]], y[[m]]>y[[m+1]]], {m, 1, Length[y]-1}];
stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Select[Range[0, 100], doupQ[stc[#]]&]
CROSSREFS
The case of permutations is counted by A000111.
Counting patterns of this type gives A350354.
The up/down version is A350355.
A003242 counts anti-run compositions.
A349057 ranks non-weakly alternating compositions.
Statistics of standard compositions:
- Length is A000120.
- Sum is A070939.
- Heinz number is A333219.
- Number of maximal anti-runs is A333381.
- Number of distinct parts is A334028.
Classes of standard compositions:
- Strict compositions are A233564.
- Constant compositions are A272919.
- Patterns are A333217.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jan 15 2022
STATUS
approved