Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Give the lexicographic index of a permutation
ResourceFunction["PermutationIndex"][perm] gives the lexicographic index of permutation perm. |
Return the index of a permutation:
In[1]:= | ![]() |
Out[1]= | ![]() |
The first permutation of a given length has index 1:
In[2]:= | ![]() |
Out[2]= | ![]() |
Some large permutations:
In[3]:= | ![]() |
Out[3]= | ![]() |
Large permutations can be indexed:
In[4]:= | ![]() |
Out[4]= | ![]() |
Terms don’t necessarily need to be positive or integer:
In[5]:= | ![]() |
Out[5]= | ![]() |
The indices of permutations and negative permutations are balanced:
In[6]:= | ![]() |
Out[6]= | ![]() |
Differences of indices of even permutations:
In[7]:= | ![]() |
Out[7]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License