OFFSET
0,7
COMMENTS
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).
An anti-run (separation or Carlitz composition) is a sequence with no adjacent equal parts.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..1000
EXAMPLE
The a(9) = 23 anti-runs:
(1,2,6) (1,2,4,2) (1,2,1,2,3)
(1,3,5) (1,2,5,1) (1,2,3,1,2)
(2,3,4) (1,3,4,1) (1,2,3,2,1)
(4,3,2) (1,4,3,1) (1,3,2,1,2)
(5,3,1) (1,5,2,1) (2,1,2,3,1)
(6,2,1) (2,1,2,4) (2,1,3,2,1)
(2,4,2,1) (3,2,1,2,1)
(3,1,2,3)
(3,2,1,3)
(4,2,1,2)
MATHEMATICA
wigQ[y_]:=Or[Length[y]==0, Length[Split[y]]== Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
sepQ[y_]:=!MatchQ[y, {___, x_, x_, ___}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], sepQ[#]&&!wigQ[#]&]], {n, 0, 15}]
CROSSREFS
Non-anti-run compositions are counted by A261983.
These compositions are ranked by A345169.
A011782 counts compositions.
A032020 counts strict compositions.
A106356 counts compositions by number of maximal anti-runs.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jun 17 2021
EXTENSIONS
a(21) onwards from Andrew Howroyd, Jan 31 2024
STATUS
approved