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