OFFSET
0,1
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.
Every sequence can be uniquely split into a sequence of non-overlapping runs. For example, the runs of (2,2,1,1,1,3,2,2) are ((2,2),(1,1,1),(3),(2,2)), with sums (4,3,3,4).
EXAMPLE
The terms and their corresponding compositions begin:
3: (1,1)
0: ()
2: (2)
8: (4)
32: (6)
68: (4,3)
130: (6,2)
290: (3,4,2)
274: (4,3,2)
580: (3,4,3)
520: (6,4)
1298: (2,4,3,2)
The inverse run-sum compositions for n = 2, 8, 32, 68, 130, 290:
(2) (4) (6) (43) (62) (342)
(11) (22) (33) (223) (332) (3411)
(1111) (222) (4111) (611) (11142)
(111111) (11113) (3311) (32211)
(22111) (22211) (111411)
(1111112) (311112)
(1112211)
MATHEMATICA
nn=1000;
stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
antirunQ[y_]:=Length[Split[y]]==Length[y];
q=Table[Length[Select[Tuples[Divisors/@stc[n]], antirunQ]], {n, 0, nn}];
w=Last[Select[Table[Take[q+1, i], {i, nn}], Union[#]==Range[Max@@#]&]-1];
Table[Position[w, k][[1, 1]]-1, {k, 0, Max@@w}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jun 21 2022
STATUS
approved