OFFSET
0,3
COMMENTS
We define the adjusted partial sums of a composition to be obtained by subtracting one from all parts, taking partial sums, and adding one back to all parts.
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 29th composition in standard order is (1,1,2,1), with adjusted partial sums (1,1,2,2), with sum 6, so a(29) = 6.
MATHEMATICA
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Table[Total[Accumulate[stc[n]-1]+1], {n, 0, 100}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Dec 21 2022
STATUS
approved