OFFSET
1,1
COMMENTS
We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either.
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.
EXAMPLE
The terms and corresponding compositions begin:
37: (3,2,1)
46: (2,1,1,2)
52: (1,2,3)
53: (1,2,2,1)
69: (4,2,1)
75: (3,2,1,1)
78: (3,1,1,2)
92: (2,1,1,3)
93: (2,1,1,2,1)
101: (1,3,2,1)
104: (1,2,4)
105: (1,2,3,1)
107: (1,2,2,1,1)
110: (1,2,1,1,2)
116: (1,1,2,3)
117: (1,1,2,2,1)
MATHEMATICA
stc[n_]:=Differences[Prepend[Join@@Position[ Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
whkQ[y_]:=And@@Table[If[EvenQ[m], y[[m]]<=y[[m+1]], y[[m]]>=y[[m+1]]], {m, 1, Length[y]-1}];
Select[Range[0, 100], !whkQ[stc[#]]&&!whkQ[-stc[#]]&]
CROSSREFS
Partitions of this type are ranked by A349794.
Non-strict partitions of this type are counted by A349796.
Permutations of prime indices of this type are counted by A349797.
A011782 counts compositions.
A349054 counts strict alternating compositions.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Dec 04 2021
STATUS
approved