Search for a tool
Rank of a Permutation

Tool to calculate the rank of a permutation of a set. The permutation's rank is the number associated with it in the order of generation of the permutations.

Results

Rank of a Permutation -

Tag(s) : Mathematics, Combinatorics

dCode and you

dCode is free and its tools are a valuable help in games, puzzles and problems to solve every day!
You have a problem, an idea for a project, a specific need and dCode can not (yet) help you? You need custom development? Contact-me!


Team dCode read all messages and answer them if you leave an email (not published). It is thanks to you that dCode has the best Rank of a Permutation tool. Thank you.

This page is using the new English version of dCode, please make comments !

Rank of a Permutation

Sponsored ads

Permutation Rank Calculation


Find a Permutation with its Rank



Tool to calculate the rank of a permutation of a set. The permutation's rank is the number associated with it in the order of generation of the permutations.

Answers to Questions

How to calculate the rank of a permutation?

To find the row of a permutationhref, list all possible permutationshref and sort them in ascending order.

Example: The set A,B,C has for permutationshref:

0ABC
1ACB
2BAC
3BCA
4CAB
5CBA

Example: The permutationhref BAC is at number 2 (starting at 0)

Since it seems difficult to list all permutationshref when there are many items. There is a mathematical method to perform this calculation.

Consider a permutationhref \( P \) in the set \( E \) of size \( t \).

Example: The permutationhref B,A,C from the initial set A,B,C of size \( t = 3 \)

For each letter, calculate the position \( p \) in the set \( E \), calculate \( s = p \times (t-1)! \) and remove the letter from the set \( E \) (size \( t \) decreases). The sum of \( s \) is the rank of the permutationhref.

Example: B is in position \( 1 \) in ABC, \( s_B = 1 \times 2! = 2 \)
A is in position \( 0 \) in AC, \( s_A = 0 \times 1! = 0 \)
C is in position \( 0 \) in C, \( s_C = 0 \ times 0! = 0 \)
BAC is at permutationhref rank \( s_B + s_A + s_C = 2 + 0 + 0 = 2 \)

Ask a new question

Source code

dCode retains ownership of the source code of the script Rank of a Permutation. Except explicit open source licence (indicated Creative Commons / free), any algorithm, applet, snippet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in any informatic langauge (PHP, Java, C#, Python, Javascript, etc.) which dCode owns rights can be transferred after sales quote. So if you need to download the Rank of a Permutation script for offline use, for you, your company or association, see you on contact page !

Questions / Comments


Team dCode read all messages and answer them if you leave an email (not published). It is thanks to you that dCode has the best Rank of a Permutation tool. Thank you.


Source : http://www.dcode.fr/permutation-rank
© 2017 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaches. dCode