|
|
A357621
|
|
Half-alternating sum of the n-th composition in standard order.
|
|
28
|
|
|
0, 1, 2, 2, 3, 3, 3, 1, 4, 4, 4, 2, 4, 2, 0, 0, 5, 5, 5, 3, 5, 3, 1, 1, 5, 3, 1, 1, -1, -1, -1, 1, 6, 6, 6, 4, 6, 4, 2, 2, 6, 4, 2, 2, 0, 0, 0, 2, 6, 4, 2, 2, 0, 0, 0, 2, -2, -2, -2, 0, -2, 0, 2, 2, 7, 7, 7, 5, 7, 5, 3, 3, 7, 5, 3, 3, 1, 1, 1, 3, 7, 5, 3, 3, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
We define the half-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.
|
|
LINKS
|
|
|
FORMULA
|
Positions of first appearances are powers of 2 and even powers of 2 times 7, or A029746 without 7.
|
|
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;
halfats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[i/2]), {i, Length[f]}];
Table[halfats[stc[n]], {n, 0, 100}]
|
|
CROSSREFS
|
See link for sequences related to standard compositions.
The version for prime indices is A357629.
The version for Heinz numbers of partitions is A357633.
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|