OFFSET
0,4
COMMENTS
Original name was: Descending wiggly sums: number of sums adding to n in which terms alternately decrease and increase.
A composition is down/up if it is alternately strictly decreasing and strictly increasing, starting with a decrease. For example, the partition (3,2,2,2,1) has no down/up permutations, even though it does have the anti-run permutation (2,1,2,3,2). - Gus Wiseman, Jan 28 2022
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Wikipedia, Alternating permutation
FORMULA
EXAMPLE
From Gus Wiseman, Jan 28 2022: (Start)
The a(1) = 1 through a(8) = 14 down/up compositions:
(1) (2) (3) (4) (5) (6) (7) (8)
(2,1) (3,1) (3,2) (4,2) (4,3) (5,3)
(4,1) (5,1) (5,2) (6,2)
(2,1,2) (2,1,3) (6,1) (7,1)
(3,1,2) (2,1,4) (2,1,5)
(2,1,2,1) (3,1,3) (3,1,4)
(4,1,2) (3,2,3)
(2,1,3,1) (4,1,3)
(3,1,2,1) (5,1,2)
(2,1,3,2)
(2,1,4,1)
(3,1,3,1)
(4,1,2,1)
(2,1,2,1,2)
(End)
MATHEMATICA
doupQ[y_]:=And@@Table[If[EvenQ[m], y[[m]]<y[[m+1]], y[[m]]>y[[m+1]]], {m, 1, Length[y]-1}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], doupQ]], {n, 0, 15}] (* Gus Wiseman, Jan 28 2022 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
a(0)=1 prepended by Alois P. Heinz, Jan 20 2022
Name changed by Gus Wiseman, Jan 28 2022
STATUS
approved