A349054 Number of alternating strict compositions of n. Number of alternating (up/down or down/up) permutations of strict integer partitions of n.
1, 1, 1, 3, 3, 5, 9, 11, 15, 21, 35, 41, 59, 75, 103, 155, 193, 255, 339, 443, 569, 841, 1019, 1365, 1743, 2295, 2879, 3785, 5151, 6417, 8301, 10625, 13567, 17229, 21937, 27509, 37145, 45425, 58345, 73071, 93409, 115797, 147391, 182151, 229553, 297061, 365625
Offset: 0
Keywords
Examples
The a(1) = 1 through a(7) = 11 compositions: (1) (2) (3) (4) (5) (6) (7) (1,2) (1,3) (1,4) (1,5) (1,6) (2,1) (3,1) (2,3) (2,4) (2,5) (3,2) (4,2) (3,4) (4,1) (5,1) (4,3) (1,3,2) (5,2) (2,1,3) (6,1) (2,3,1) (1,4,2) (3,1,2) (2,1,4) (2,4,1) (4,1,2)
Links
- Wikipedia, Alternating permutation
Crossrefs
Programs
-
Maple
g:= proc(u, o) option remember; `if`(u+o=0, 1, add(g(o-1+j, u-j), j=1..u)) end: b:= proc(n, k) option remember; `if`(k<0 or n<0, 0, `if`(k=0, `if`(n=0, 2, 0), b(n-k, k)+b(n-k, k-1))) end: a:= n-> add(b(n, k)*g(k, 0), k=0..floor((sqrt(8*n+1)-1)/2))-1: seq(a(n), n=0..46); # Alois P. Heinz, Dec 22 2021
-
Mathematica
wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1]; Table[Length[Select[Join@@Permutations/@Select[IntegerPartitions[n],UnsameQ@@#&],wigQ]],{n,0,15}]
Comments