login
A357623
Skew-alternating sum of the n-th composition in standard order.
23
0, 1, 2, 0, 3, 1, -1, -1, 4, 2, 0, 0, -2, -2, -2, 0, 5, 3, 1, 1, -1, -1, -1, 1, -3, -3, -3, -1, -3, -1, 1, 1, 6, 4, 2, 2, 0, 0, 0, 2, -2, -2, -2, 0, -2, 0, 2, 2, -4, -4, -4, -2, -4, -2, 0, 0, -4, -2, 0, 0, 2, 2, 2, 0, 7, 5, 3, 3, 1, 1, 1, 3, -1, -1, -1, 1, -1
OFFSET
0,3
COMMENTS
We define the skew-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A - B - C + D + E - F - G + ....
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.
EXAMPLE
The 358-th composition is (2,1,3,1,2) so a(358) = 2 - 1 - 3 + 1 + 2 = 1.
MATHEMATICA
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
skats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[(i+1)/2]), {i, Length[f]}];
Table[skats[stc[n]], {n, 0, 100}]
CROSSREFS
See link for sequences related to standard compositions.
Positions of positive firsts appear to be A029744.
The half-alternating form is A357621, reverse A357622.
The reverse version is A357624.
Positions of zeros are A357627, reverse A357628.
The version for prime indices is A357630.
The version for Heinz numbers of partitions is A357634.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.
Sequence in context: A124756 A113504 A358726 * A276165 A344618 A124754
KEYWORD
sign
AUTHOR
Gus Wiseman, Oct 08 2022
STATUS
approved