%I #14 Nov 06 2021 02:25:56
%S 0,1,2,4,5,6,8,9,12,13,16,17,18,20,22,24,25,32,33,34,38,40,41,44,45,
%T 48,49,50,54,64,65,66,68,70,72,76,77,80,81,82,88,89,96,97,98,102,108,
%U 109,128,129,130,132,134,140,141,144,145,148,152,153,160,161,162
%N Numbers k such that the k-th composition in standard order is alternating.
%C 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.
%C A sequence is alternating if it is alternately strictly increasing and strictly decreasing, starting with either. For example, the partition (3,2,2,2,1) has no alternating permutations, even though it does have the anti-run permutations (2,3,2,1,2) and (2,1,2,3,2).
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Alternating_permutation">Alternating permutation</a>
%e The terms together with their binary indices begin:
%e 1: (1) 25: (1,3,1) 66: (5,2)
%e 2: (2) 32: (6) 68: (4,3)
%e 4: (3) 33: (5,1) 70: (4,1,2)
%e 5: (2,1) 34: (4,2) 72: (3,4)
%e 6: (1,2) 38: (3,1,2) 76: (3,1,3)
%e 8: (4) 40: (2,4) 77: (3,1,2,1)
%e 9: (3,1) 41: (2,3,1) 80: (2,5)
%e 12: (1,3) 44: (2,1,3) 81: (2,4,1)
%e 13: (1,2,1) 45: (2,1,2,1) 82: (2,3,2)
%e 16: (5) 48: (1,5) 88: (2,1,4)
%e 17: (4,1) 49: (1,4,1) 89: (2,1,3,1)
%e 18: (3,2) 50: (1,3,2) 96: (1,6)
%e 20: (2,3) 54: (1,2,1,2) 97: (1,5,1)
%e 22: (2,1,2) 64: (7) 98: (1,4,2)
%e 24: (1,4) 65: (6,1) 102: (1,3,1,2)
%t stc[n_]:=Differences[Prepend[Join@@Position[ Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
%t wigQ[y_]:=Or[Length[y]==0,Length[Split[y]] ==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
%t Select[Range[0,100],wigQ@*stc]
%Y These compositions are counted by A025047, complement A345192.
%Y The complement is A345168.
%Y Partitions with a permutation of this type: A345170, complement A345165.
%Y Factorizations with a permutation of this type: A348379.
%Y A001250 counts alternating permutations, complement A348615.
%Y A003242 counts anti-run compositions.
%Y A345164 counts alternating permutations of prime indices.
%Y A345194 counts alternating patterns, with twins A344605.
%Y Statistics of standard compositions:
%Y - Length is A000120.
%Y - Constant runs are A124767.
%Y - Heinz number is A333219.
%Y - Number of maximal anti-runs is A333381.
%Y - Runs-resistance is A333628.
%Y - Number of distinct parts is A334028.
%Y Classes of standard compositions:
%Y - Weakly decreasing compositions (partitions) are A114994.
%Y - Weakly increasing compositions (multisets) are A225620.
%Y - Anti-runs are A333489.
%Y - Non-alternating anti-runs are A345169.
%Y Cf. A025048, A025049, A059893, A106356, A238279, A335448, A344604, A344615, A344653, A344742, A345163, A348377.
%K nonn
%O 1,3
%A _Gus Wiseman_, Jun 15 2021