A357185 Numbers k such that the k-th composition in standard order has the same length as the absolute value of its alternating sum.
0, 1, 9, 12, 19, 22, 28, 34, 40, 69, 74, 84, 97, 104, 132, 135, 141, 144, 153, 177, 195, 198, 204, 216, 225, 240, 265, 271, 274, 283, 286, 292, 307, 310, 316, 321, 328, 355, 358, 364, 376, 386, 400, 451, 454, 460, 472, 496, 520, 523, 526, 533, 538, 544, 553
Offset: 1
Keywords
Examples
The sequence together with the corresponding compositions begins: 0: () 1: (1) 9: (3,1) 12: (1,3) 19: (3,1,1) 22: (2,1,2) 28: (1,1,3) 34: (4,2) 40: (2,4) 69: (4,2,1) 74: (3,2,2) 84: (2,2,3) 97: (1,5,1) 104: (1,2,4) 132: (5,3) 135: (5,1,1,1) 141: (4,1,2,1)
Links
Crossrefs
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}]; Select[Range[0,100],Length[stc[#]]==Abs[ats[stc[#]]]&]
Comments