OFFSET
0,3
COMMENTS
The n-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 n, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
It would be very interesting to have a formula or general construction for a(n). - Gus Wiseman, Feb 12 2022
LINKS
Mathematics Stack Exchange, What is a sequence run? (answered 2011-12-01)
EXAMPLE
The terms together with their binary expansions and corresponding compositions begin:
0: 0 ()
1: 1 (1)
5: 101 (2,1)
27: 11011 (1,2,1,1)
155: 10011011 (3,1,2,1,1)
1655: 11001110111 (1,3,1,1,2,1,1,1)
18039: 100011001110111 (4,1,3,1,1,2,1,1,1)
281975: 1000100110101110111 (4,3,1,2,2,1,1,2,1,1,1)
MATHEMATICA
stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
s=Table[Length[Union[Split[stc[n]]]], {n, 0, 1000}];
Table[Position[s, k][[1, 1]]-1, {k, Union[s]}]
CROSSREFS
The version for Heinz numbers and prime multiplicities is A006939.
Counting not necessarily distinct runs gives A113835 (up to zero).
Using binary expansions instead of standard compositions gives A350952.
These are the positions of first appearances in A351014.
A011782 counts integer compositions.
A044813 lists numbers whose binary expansion has distinct run-lengths.
Counting words with all distinct runs:
- Length is A000120.
- Sum is A070939.
- Runs are counted by A124767.
- Number of distinct parts is A334028.
KEYWORD
nonn,more
AUTHOR
Gus Wiseman, Feb 10 2022
STATUS
approved