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 up/down if it is alternately strictly increasing and strictly decreasing, starting with an increase. For example, the partition (3,2,2,2,1) has no up/down permutations, even though it does have the anti-run permutation (2,3,2,1,2).
EXAMPLE
The terms together with the corresponding compositions begin:
0: ()
1: (1)
2: (2)
4: (3)
6: (1,2)
8: (4)
12: (1,3)
13: (1,2,1)
16: (5)
20: (2,3)
24: (1,4)
25: (1,3,1)
32: (6)
40: (2,4)
41: (2,3,1)
48: (1,5)
49: (1,4,1)
50: (1,3,2)
54: (1,2,1,2)
MATHEMATICA
updoQ[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], updoQ[stc[#]]&]
CROSSREFS
The case of permutations is counted by A000111.
Counting patterns of this type gives A350354.
The down/up version is A350356.
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