OFFSET
0,5
COMMENTS
We define the run-compression of a sequence to be the anti-run obtained by reducing each run of repeated parts to a single part. Alternatively, we remove all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has run-compression (1,2,1).
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.
LINKS
EXAMPLE
The 11th composition in standard order is (2,1,1), with run-compression (2,1) and maximal runs ((2),(1,1)), so a(11) = 3 - 2 = 1.
MATHEMATICA
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Table[Total[First/@Split[stc[n]]]-Length[Split[stc[n]]], {n, 0, 100}]
CROSSREFS
Positions of 0 are A000225.
A011782 counts compositions.
A066099 lists compositions in standard order.
A114901 counts compositions with no isolated parts.
All of the following pertain to compositions in standard order:
- Length is A000120.
- Sum is A070939.
- Constant compositions are A272919.
- Anti-runs are counted by A333381.
- Run-lengths are A333769 (triangle).
KEYWORD
nonn
AUTHOR
Gus Wiseman, Oct 11 2025
STATUS
approved
