login
A390991
Sum of first sums of the n-th composition in standard order.
3
0, 0, 0, 2, 0, 3, 3, 4, 0, 4, 4, 5, 4, 6, 5, 6, 0, 5, 5, 6, 5, 7, 6, 7, 5, 8, 7, 8, 6, 8, 7, 8, 0, 6, 6, 7, 6, 8, 7, 8, 6, 9, 8, 9, 7, 9, 8, 9, 6, 10, 9, 10, 8, 10, 9, 10, 7, 10, 9, 10, 8, 10, 9, 10, 0, 7, 7, 8, 7, 9, 8, 9, 7, 10, 9, 10, 8, 10, 9, 10, 7, 11
OFFSET
0,4
COMMENTS
The first sums of a nonempty sequence (a, b, c, d, ...) are (a+b, b+c, c+d, ...).
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.
FORMULA
a(n) = 2*A029837(n) - A001511(n) - A065120(n).
EXAMPLE
The 300-th composition in standard order is (3,2,1,3), with first sums (5,3,4), with sum 12, so a(300) = 12.
MATHEMATICA
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
firsums[c_]:=Table[c[[i]]+c[[i+1]], {i, Length[c]-1}];
Table[Total[firsums[stc[n]]], {n, 0, 100}]
CROSSREFS
For run lengths instead of first sums we have A000120.
This is the sum of first sums of rows of A066099.
For differences instead of sums we have A358135, row sums of A358133.
For partial sums instead of first sums we have A359042, row sums of A358134.
These are row sums of A390432, row ranks A390568.
A011782 counts compositions.
A175342 counts arithmetic progressions, ranks A389731, subsets A051336.
A342527 counts compositions with all equal first sums, ranks A390674.
A390307 lists first sums of prime indices, ranks A390449.
Sequence in context: A283981 A291307 A239313 * A046667 A108407 A180772
KEYWORD
nonn
AUTHOR
Gus Wiseman, Nov 26 2025
STATUS
approved