# Algorithm: Permutations & Signature

Theoretical side

Simple example: If I have two sets $$A_1=\{1,3\} ,A_2=\{2,3\}$$

and Permutations[{1, 2, 3}]= $$\left( \begin{array}{ccc} 1 & 2 & 3 \\ 1 & 3 & 2 \\ 2 & 1 & 3 \\ 2 & 3 & 1 \\ 3 & 1 & 2 \\ 3 & 2 & 1 \\ \end{array} \right)$$

Solution steps

1- Choose the rows whose sets $$A_1=\{1,3\} ,A_2=\{2,3\}$$ are partial and then count the number of rows $$D_2=\{1,3,2\},\{3,1,2\},\{2,3,1\},\{3,2,1\}$$

$$S_2=Count[D_2]/Count[Permutations[\{1, 2, 3\}]]=4/6$$

2- Delete $$D_2$$ from $$Permutations[\{1, 2, 3\}]$$ and choose from the triple order whose sets $$A_1=\{1,3\} ,A_2=\{2,3\}$$ are partial and then count the number of rows

$$D_3=\{1,2,3\},\{2,1,3\}$$

$$S_3=Count[D_3]/Count[Permutations[\{1, 2, 3\}]]=2/6$$

How can you write code that achieves this algorithm and maintains globality?

###########

#Edit

sets are partial:The group is contained within the second order

$$D_2$$:Such that

$$A_1=\{1,3\}\subset\{1,3,-\}$$ take $$\{1,3,-\}$$ $$A_1=\{1,3\}\subset\{3,1,-\}$$ take $$\{3,1,-\}$$ $$A_2=\{2,3\}\subset\{2,3,-\}$$ take $$\{1,3,-\}$$ $$A_2=\{2,3\}\subset\{3,2,-\}$$ take $$\{3,1,-\}$$

Then; We obtain $$D_2=\{1,3,2\},\{3,1,2\},\{2,3,1\},\{3,2,1\}$$

$$D_3$$:Such that

$$A_1=\{1,3\}\subset\{1,2,3\}$$ take $$\{1,2,3\}$$ $$A_1=\{2,3\}\subset\{2,1,3\}$$ take $$\{2,1,3\}$$

Then; We obtain $$D_3=\{1,2,3\},\{2,1,3\}$$

• Please clarify what you mean by "sets are partial". May 10 at 0:34
• @CarlWoll sets are partial: The set is contained within the second order $D_2$; $A_1=\{1,3\}\subset\{1,3,-\}$ or $A_1=\{1,3\}\subset\{3,1,-\}$ And, The set is contained within the thirds order $D_3$; $A_1=\{1,3\}\subset\{1,2,3\}$ May 10 at 0:46