A349055 Number of multisets of size n that have an alternating permutation and cover an initial interval of positive integers.
1, 1, 1, 3, 5, 12, 24, 52, 108, 224, 464, 944, 1936, 3904, 7936, 15936, 32192, 64512, 129792, 259840, 521472, 1043456, 2091008, 4183040, 8375296, 16752640, 33525760, 67055616, 134156288, 268320768, 536739840, 1073496064, 2147205120, 4294443008, 8589344768
Offset: 0
Keywords
Examples
The multiset {1,2,2,3} has alternating permutations (2,1,3,2), (2,3,1,2), so is counted under a(4). The a(1) = 1 through a(5) = 12 multisets: {1} {1,2} {1,1,2} {1,1,2,2} {1,1,1,2,2} {1,2,2} {1,1,2,3} {1,1,1,2,3} {1,2,3} {1,2,2,3} {1,1,2,2,2} {1,2,3,3} {1,1,2,2,3} {1,2,3,4} {1,1,2,3,3} {1,1,2,3,4} {1,2,2,3,3} {1,2,2,3,4} {1,2,3,3,3} {1,2,3,3,4} {1,2,3,4,4} {1,2,3,4,5} As compositions: (1) (1,1) (1,2) (2,2) (2,3) (2,1) (1,1,2) (3,2) (1,1,1) (1,2,1) (1,1,3) (2,1,1) (1,2,2) (1,1,1,1) (2,1,2) (2,2,1) (3,1,1) (1,1,1,2) (1,1,2,1) (1,2,1,1) (2,1,1,1) (1,1,1,1,1)
Links
- Andrew Howroyd, Table of n, a(n) for n = 0..1000
- Wikipedia, Alternating permutation
Crossrefs
Programs
-
Mathematica
allnorm[n_]:=If[n<=0,{{}},Function[s, Array[Count[s,y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]]; wigQ[y_]:=Or[Length[y]==0, Length[Split[y]]==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1]; Table[Length[Select[allnorm[n], Select[Permutations[#],wigQ]!={}&]],{n,0,7}]
-
PARI
a(n) = if(n==0, 1, 2^(n-1) - if(n%2==0, (n+2)*2^(n/2-3), (n-1)*2^((n-5)/2))) \\ Andrew Howroyd, Jan 13 2024
Formula
a(n) = 2^(n-1) - (n+2)*2^(n/2-3) for even n > 0; a(n) = 2^(n-1) - (n-1)*2^((n-5)/2) for odd n. - Andrew Howroyd, Jan 13 2024
Extensions
Terms a(10) and beyond from Andrew Howroyd, Jan 13 2024
Comments