login
A391983
Irregular triangle read by rows where row n lists the trimmed zero-based partial alternating sums of the n-th composition in standard order.
26
1, 2, 1, 0, 3, 2, -1, 1, 1, 1, 0, 1, 4, 3, -2, 2, 0, 2, -1, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 0, 1, 0, 5, 4, -3, 3, -1, 3, -2, 3, 2, 1, 2, 0, 1, 2, -1, 3, 2, -1, 2, -1, 1, 3, 1, 2, -1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 3, 1, 0, 2, -1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 6, 5, -4, 4, -2
OFFSET
1,2
COMMENTS
Row 0 is empty, so offset is 1.
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 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.
For example, the k-based partial alternating sums of q = (a,b,c,d,e) are:
pas(q,k)_0 = k
pas(q,k)_1 = -k + a
pas(q,k)_2 = k - a + b
pas(q,k)_3 = -k + a - b + c
pas(q,k)_4 = k - a + b - c + d
pas(q,k)_5 = -k + a - b + c - d + e
These are trimmed by removing the zeroth line (which is always k).
EXAMPLE
The 19-th standard composition is (3,1,1), and pas((3,1,1),0) = (0,3,-2,3), so row 19 is (3,-2,3).
Triangle begins:
0: .
1: 1
2: 2
3: 1 0
4: 3
5: 2 -1
6: 1 1
7: 1 0 1
8: 4
9: 3 -2
10: 2 0
11: 2 -1 2
12: 1 2
13: 1 1 0
14: 1 0 2
15: 1 0 1 0
16: 5
17: 4 -3
18: 3 -1
19: 3 -2 3
20: 2 1
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]}];
Table[Rest[pas[stc[n], 0]], {n, 20}]
CROSSREFS
Row lengths are A000120.
First term in each row is A065120.
Last term in each row is A344618, see also A124754.
For prime indices we have A391981, row sums A346699, alternating A316524.
For reversed prime indices we have A391982, sums A346697, alternating A344616.
The reverse version is A391984.
Row sums are A392369 (even A392370), non-reverse A209281 (even A346633).
A011782 counts compositions.
A066099 lists standard compositions, sums A070939, first sums A390432.
A116406 counts compositions with alternating sum >= 0.
A357213 counts compositions by sum of first sums.
A390673 ranks compositions with distinct first sums, count A390567.
A390676 ranks compositions that are first sums, union of A390568.
A390745 ranks compositions that are uniquely first sums, count A391644.
Sequence in context: A212278 A244215 A389733 * A255325 A391368 A025654
KEYWORD
sign,tabf
AUTHOR
Gus Wiseman, Jan 10 2026
STATUS
approved