OFFSET
0,3
COMMENTS
The first sums of a nonempty sequence (a, b, c, d, ...) are (a+b, b+c, c+d, ...).
Also the number of integer compositions of n with all distinct trimmed 0-based partial alternating sums. Here, 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 composition (2,1,2,1) is the first sums of (0,2,-1,3,-2) so is counted under a(6).
The composition (1,2,1,2) has 0-based partial alternating sums (0,1,1,0,2), trimmed (1,1,0,2), so is not counted under a(6).
The a(1) = 1 through a(6) = 14 compositions:
(1) (2) (3) (4) (5) (6)
(1,1) (2,1) (1,3) (1,4) (1,5)
(2,2) (2,3) (3,3)
(3,1) (3,2) (4,2)
(1,1,2) (4,1) (5,1)
(1,1,3) (1,1,4)
(1,3,1) (1,3,2)
(2,1,2) (1,4,1)
(2,2,1) (2,1,3)
(1,1,2,1) (2,3,1)
(3,1,2)
(3,2,1)
(1,1,3,1)
(2,1,2,1)
MATHEMATICA
pas[y_, k_]:=Table[(-1)^j*k+Sum[(-1)^(i+j)*y[[i]], {i, j}], {j, 0, Length[y]}];
Table[Length[Select[Join @@ Permutations/@IntegerPartitions[n], UnsameQ@@Rest[pas[#, 0]]&]], {n, 0, 15}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jan 31 2026
EXTENSIONS
a(23)-a(38) from Christian Sievers, Feb 08 2026
STATUS
approved
