login
Positive integers k such that there is more than one nonnegative sequence whose first sums are the k-th composition in standard order.
13

%I #16 Feb 24 2026 08:21:20

%S 1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,26,28,30,

%T 31,32,33,34,35,36,37,38,39,40,42,43,44,46,47,48,52,53,56,58,60,62,63,

%U 64,65,66,67,68,69,70,71,72,73,74,75,76,78,79,80,82,84

%N Positive integers k such that there is more than one nonnegative sequence whose first sums are the k-th composition in standard order.

%C The first sums of a nonempty sequence (a, b, c, d, ...) are (a+b, b+c, c+d, ...).

%C 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.

%C 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.

%F Complement of (A390747 U A391622).

%e 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.

%e 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.

%t stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;

%t pas[y_,k_]:=Table[(-1)^j*k+Sum[(-1)^(i+j)*y[[i]],{i,j}],{j,0,Length[y]}];

%t Select[Range[100], Length[Select[Table[pas[stc[#],b],{b,0,Max[stc[#]]}], Min@@#>=0&]]>1&]

%Y For no choices we have A390747, count A391645.

%Y These are positions of terms > 1 in A391621.

%Y For a unique choice we have A391622, count A391643.

%Y These compositions are counted by A391682.

%Y For compositions we have:

%Y - at least one choice: A390676, count A391683

%Y - no choices: A390677, count A391680

%Y - unique choice: A390745, count A391644

%Y - more than one choice: A391627, count A391628

%Y A011782 counts compositions.

%Y A066099 lists all compositions in standard order.

%Y A357213 counts compositions by sum of first sums.

%Y A390432 lists first sums of standard compositions.

%Y A390449 ranks first sums of prime indices, listed by A390307 or A390362.

%Y A390673 ranks compositions with distinct first sums, counted by A390567.

%Y A390674 ranks compositions with equal first sums, counted by A342527.

%Y A391642 counts compositions with standard first sums.

%Y Cf. A000120, A001511, A029837, A029931, A070939, A390448, A390568, A390675, A390678, A391983.

%K nonn

%O 1,2

%A _Gus Wiseman_, Jan 02 2026