A345167 Numbers k such that the k-th composition in standard order is alternating.
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, 48, 49, 50, 54, 64, 65, 66, 68, 70, 72, 76, 77, 80, 81, 82, 88, 89, 96, 97, 98, 102, 108, 109, 128, 129, 130, 132, 134, 140, 141, 144, 145, 148, 152, 153, 160, 161, 162
Offset: 1
Keywords
Examples
The terms together with their binary indices begin: 1: (1) 25: (1,3,1) 66: (5,2) 2: (2) 32: (6) 68: (4,3) 4: (3) 33: (5,1) 70: (4,1,2) 5: (2,1) 34: (4,2) 72: (3,4) 6: (1,2) 38: (3,1,2) 76: (3,1,3) 8: (4) 40: (2,4) 77: (3,1,2,1) 9: (3,1) 41: (2,3,1) 80: (2,5) 12: (1,3) 44: (2,1,3) 81: (2,4,1) 13: (1,2,1) 45: (2,1,2,1) 82: (2,3,2) 16: (5) 48: (1,5) 88: (2,1,4) 17: (4,1) 49: (1,4,1) 89: (2,1,3,1) 18: (3,2) 50: (1,3,2) 96: (1,6) 20: (2,3) 54: (1,2,1,2) 97: (1,5,1) 22: (2,1,2) 64: (7) 98: (1,4,2) 24: (1,4) 65: (6,1) 102: (1,3,1,2)
Links
- Wikipedia, Alternating permutation
Crossrefs
The complement is A345168.
Factorizations with a permutation of this type: A348379.
A003242 counts anti-run compositions.
A345164 counts alternating permutations of prime indices.
Statistics of standard compositions:
- Length is A000120.
- Constant runs are A124767.
- Heinz number is A333219.
- Number of maximal anti-runs is A333381.
- Runs-resistance is A333628.
- Number of distinct parts is A334028.
Classes of standard compositions:
- Weakly decreasing compositions (partitions) are A114994.
- Weakly increasing compositions (multisets) are A225620.
- Anti-runs are A333489.
- Non-alternating anti-runs are A345169.
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join@@Position[ Reverse[IntegerDigits[n,2]],1],0]]//Reverse; wigQ[y_]:=Or[Length[y]==0,Length[Split[y]] ==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1]; Select[Range[0,100],wigQ@*stc]
Comments