OFFSET
0,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.
EXAMPLE
The terms together with their corresponding compositions begin:
0: ()
1: (1)
11: (2,1,1)
119: (1,1,2,1,1,1)
5615: (2,2,1,1,1,2,1,1,1,1)
251871: (1,1,1,2,2,1,1,1,1,2,1,1,1,1,1)
MATHEMATICA
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
pd=Table[Length[Union[Length/@Split[stc[n]]]], {n, 0, 10000}];
Table[Position[pd, n][[1, 1]]-1, {n, 0, Max@@pd}]
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Gus Wiseman, Jun 23 2022
STATUS
approved