%I #5 Jan 12 2026 08:42:27
%S 1,2,1,0,3,1,1,2,-1,1,0,1,4,1,2,2,0,1,0,2,3,-2,1,1,0,2,-1,2,1,0,1,0,5,
%T 1,3,2,1,1,0,3,3,-1,1,1,1,2,-1,3,1,0,1,1,4,-3,1,2,-1,2,0,1,1,0,2,-1,3,
%U -2,3,1,1,0,1,2,-1,2,-1,1,0,1,0,1,6,1,4,2,2
%N Irregular triangle read by rows where row n lists the trimmed zero-based partial alternating sums of the reversed n-th composition in standard order.
%C Row 0 is empty, so offset is 1.
%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 The k-based partial alternating sums of a finite sequence q are given by pas(q,k)_j = (-1)^j * k + 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.
%C For example, the k-based partial alternating sums of q = (a,b,c,d,e) are:
%C pas(q,k)_0 = k
%C pas(q,k)_1 = -k + a
%C pas(q,k)_2 = k - a + b
%C pas(q,k)_3 = -k + a - b + c
%C pas(q,k)_4 = k - a + b - c + d
%C pas(q,k)_5 = -k + a - b + c - d + e
%C These are trimmed by removing the zeroth line (which is always k).
%e The 19-th standard composition is (3,1,1), and pas((1,1,3),0) = (0,1,0,3), so row 19 is (1,0,3).
%e Triangle begins:
%e 0: .
%e 1: 1
%e 2: 2
%e 3: 1 0
%e 4: 3
%e 5: 1 1
%e 6: 2 -1
%e 7: 1 0 1
%e 8: 4
%e 9: 1 2
%e 10: 2 0
%e 11: 1 0 2
%e 12: 3 -2
%e 13: 1 1 0
%e 14: 2 -1 2
%e 15: 1 0 1 0
%e 16: 5
%e 17: 1 3
%e 18: 2 1
%e 19: 1 0 3
%e 20: 3 -1
%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 Table[Rest[pas[Reverse[stc[n]],0]],{n,20}]
%Y Row lengths are A000120.
%Y First term in each row is A001511.
%Y Last term in each row is A124754, see also A344618.
%Y Row sums are A209281 (even A346633), unreversed A392369 (even A392370).
%Y For prime indices we have A391981, row sums A346699, alternating A316524.
%Y For reversed prime indices we have A391982, row sums A346697, alternating A344616.
%Y The unreversed version is A391983.
%Y A011782 counts compositions.
%Y A066099 lists standard compositions, sums A070939, first sums A390432.
%Y A116406 counts compositions with alternating sum >= 0.
%Y A357213 counts compositions by sum of first sums.
%Y A390673 ranks compositions with distinct first sums, count A390567.
%Y A390676 ranks compositions that are first sums, union of A390568.
%Y A390745 ranks compositions that are uniquely first sums, count A391644.
%Y Cf. A003242, A005674, A025047, A065120, A124767, A342527, A344619, A390675, A390677, A391621, A391642, A391645, A391683.
%K sign,tabf
%O 1,2
%A _Gus Wiseman_, Jan 11 2026