OFFSET
1,2
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.
Also numbers k such that there is a unique integer b such that the b-based partial alternating sums of the k-th composition in standard order are all nonnegative. Here, the b-based partial alternating sums of a finite sequence q are given by pas(q,b)_j = (-1)^j * b + Sum_{i=1..j} (-1)^(i+j) * q_i. This is a signed version of the partial sums transformation, inverse to the "first sums" transformation.
EXAMPLE
For n = 54, the composition (1,2,1,2) is the first sums of (0,1,1,0,2) only, so 54 is not in the sequence.
For n = 150, all sequences with first sums (3,2,1,2) are of the form (b,3-b,-1+b,2-b,b) for some b. This is nonnegative for b = 1 or b = 2, so 150 is in the sequence.
MATHEMATICA
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
pas[y_, k_]:=Table[(-1)^j*k+Sum[(-1)^(i+j)*y[[i]], {i, j}], {j, 0, Length[y]}];
Select[Range[100], Length[Select[Table[pas[stc[#], b], {b, 0, Max[stc[#]]}], Min@@#>=0&]]>1&]
CROSSREFS
These are positions of terms > 1 in A391621.
These compositions are counted by A391682.
For compositions we have:
A011782 counts compositions.
A066099 lists all compositions in standard order.
A357213 counts compositions by sum of first sums.
A390432 lists first sums of standard compositions.
A391642 counts compositions with standard first sums.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jan 02 2026
STATUS
approved
