OFFSET
1,2
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.
The first sums of a nonempty sequence (a, b, c, d, ...) are (a+b, b+c, c+d, ...).
LINKS
FORMULA
a(2^k) = k+1.
EXAMPLE
The 68-th composition in standard order is (4,3), which is the first sums of both (2,2,1) and (3,1,2), so a(34) = 2.
MATHEMATICA
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
uncha[tar_, ini_]:=(cur={ini}; Do[AppendTo[cur, tar[[k]]-If[k==1, ini, cur[[k]]]], {k, Length[tar]}]; cur);
Table[Length[Select[Table[uncha[stc[n], i], {i, Max[stc[n]]}], Min@@#>=1&]], {n, 2, 100, 2}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Nov 22 2025
STATUS
approved
