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.
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:
0: ()
1: (1)
2: (2)
4: (3)
5: (2,1)
6: (1,2)
8: (4)
9: (3,1)
10: (2,2)
12: (1,3)
13: (1,2,1)
16: (5)
17: (4,1)
18: (3,2)
20: (2,3)
21: (2,2,1)
22: (2,1,2)
For example, the 21st composition in standard order (2,2,1) equals the run-sums of (1,1,2,1), so 21 is in the sequence. On the other hand, no composition has run-sums equal to the 29th composition (1,1,2,1), so 29 is not in the sequence.
MATHEMATICA
stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Select[Range[0, 100], MemberQ[Total/@Split[#]&/@ Join@@Permutations/@IntegerPartitions[Total[stc[#]]], stc[#]]&]
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jun 22 2022
STATUS
approved