A357623 Skew-alternating sum of the n-th composition in standard order.
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
Keywords
Examples
The 358-th composition is (2,1,3,1,2) so a(358) = 2 - 1 - 3 + 1 + 2 = 1.
Links
Crossrefs
Programs
-
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}]
Comments