VOOZH about

URL: https://oeis.org/A391984

⇱ A391984 - OEIS


login
A391984
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.
9
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, 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, -2, 3, 1, 1, 0, 1, 2, -1, 2, -1, 1, 0, 1, 0, 1, 6, 1, 4, 2, 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((1,1,3),0) = (0,1,0,3), so row 19 is (1,0,3).
Triangle begins:
0: .
1: 1
2: 2
3: 1 0
4: 3
5: 1 1
6: 2 -1
7: 1 0 1
8: 4
9: 1 2
10: 2 0
11: 1 0 2
12: 3 -2
13: 1 1 0
14: 2 -1 2
15: 1 0 1 0
16: 5
17: 1 3
18: 2 1
19: 1 0 3
20: 3 -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[Reverse[stc[n]], 0]], {n, 20}]
CROSSREFS
Row lengths are A000120.
First term in each row is A001511.
Last term in each row is A124754, see also A344618.
Row sums are A209281 (even A346633), unreversed A392369 (even A392370).
For prime indices we have A391981, row sums A346699, alternating A316524.
For reversed prime indices we have A391982, row sums A346697, alternating A344616.
The unreversed version is A391983.
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: A363048 A262114 A320780 * A029312 A287352 A391981
KEYWORD
sign,tabf
AUTHOR
Gus Wiseman, Jan 11 2026
STATUS
approved