Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the major index of a permutation
ResourceFunction["PermutationMajorIndex"][p] gives the major index of the permutation p. |
Since descents of this permutation are at positions 2 and 4, the major index is 2+4=6:
| In[1]:= |
| Out[1]= |
There are six permutations of length 4 with major index 3:
| In[2]:= |
| Out[2]= |
| In[3]:= |
| Out[3]= |
There is an equal number of permutations of length 4 with three inversions:
| In[4]:= |
| Out[4]= |
| In[5]:= |
| Out[5]= |
The number of permutations of length n with major index k and inversion count i is the same as the number of permutations of length n with major index i and inversion count k:
| In[6]:= |
| In[7]:= |
| In[8]:= | ![]() |
| Out[8]= |
The number of permutations of length 4 with given major index and inversion count:
| In[9]:= |
| In[10]:= | ![]() |
| Out[10]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License