Spec Investigation 1 Take-Home

Date: 2023-03-23

(don’t copy it directly you little shit do it yourself) (note: the permutators look messed up. I DON’T KNOW HOW TO FIX THIS!)

1) What is the total number of different 7-permutators?

The total number of different 7-permutators is $7!$

Definition Intermission

The “cycles” of an n-permutator are the groups of numbers that “point” to each other. e.g. $\begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 \ 1 & 2 & 3 & 4 & 5 & 6 & 7\end{pmatrix}$ has 7 1-length cycles.

$\begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 \ 2 & 3 & 1 & 5 & 6 & 7 & 4\end{pmatrix}$ has a cycle of length 3 and a cycle of length 4.

$\begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 \ 9 & 3 & 6 & 8 & 4 & 7 & 1 & 10 & 5 & 13 & 11 & 12 & 2\end{pmatrix}$ has 1 cycle of length 11 and two cycles of length 1.

The loop length of a permutator is equal to the least common multiple of its cycles.

Also; shorthand for all n-permutators with cycles a, b… is $n\langle a,b…\rangle$, ignoring cycles of length 1.

2) How many different 7-permutators swap the letters within just one pair (and leave all the other letters in the same place)?

This is all $7\langle 2\rangle$. The number is $\frac{7!(2-1)!}{(7-2)!2!1!} = 21$.

3) How many different 7-permutators swap letters within exactly 2 pairs? How many swap letters within 3 pairs (always leaving the other letters in the same place)?

Two pairs is $7\langle 2,2\rangle$. The number is $\frac{7!(2-1)!}{(7-4)!2!2!2!} = 105$. Three pairs is $7\langle 2,2,2\rangle$. The number is $\frac{7!(2-1)!}{(7-6)!2!2!2!3!} = 105$.

4) How many different 7-permutators move exactly 3 letters (leaving the other letters where they are)?

This is all $7\langle 3\rangle$. The number is $\frac{7!(3-1)!}{(7-3)!3!1!} = 70$.

An observation and formula

The number of ways you can order the elements in a cycle with length $n$ (they cannot be at their own index) is $(n-1)!$
The formula for $n\langle a,b,…x\rangle$, where $c_l$ represents the number of cycles of length $l$, is $\frac{n!}{(n-a-b-…-x)!\times ab…x \times c_2!c_3!…}$. $c_l$ can be removed for $l$ not in $\langle a…x\rangle$.

Derivation (optional, but useful)

Okay, WOW. This one was annoying, but fun to calculate.
First, start with the identity permutator $\begin{pmatrix}1 & 2 & 3 & … & n \ 1 & 2 & 3 & … & n\end{pmatrix}$.
The number of indices that are part of cycles can be represented as $a+b+…+x$.
We can get the number of indices in cycles with $\binom{n}{a+b+…+x}$, or $\frac{n!}{(n-a-b-…-x)!(a+b+…+x)!}$.
We now have the indices which will be part of our cycles without order.
Next, we must find the number of ways we can make our cycles.
The number of ways we can make cycles can be represented by $\frac{(a+b+…+x)!}{a!b!…x!}$, derived from (using 4 as an example) $\binom{a+b+c+d}{a}\binom{b+c+d}{b}\binom{c+d}{c}\binom{d}{d}$, or $\frac{(a+b+c+d)!}{a!(b+c+d)!}\times\frac{(b+c+d)!}{b!(c+d)!}\times\frac{(c+d)!}{c!d!}\times\frac{d!}{d!0!} = \frac{(a+b+c+d)!}{a!b!c!d!}$.
Multiplying these together to get the total number of ways we can make distinct unordered cycles of length $a,b…x$ using $n$ indices, we get $\frac{n!(a+b+…+x)!}{(n-a-b-…-x)!(a+b+…+x)!a!b!c!d!} = \frac{n!}{(n-a-b-…-x)!a!b!c!d!}$.
There are two flaws with this formula, which we can account for.

  1. It treats cycles of equal length as distinct sequences, which is not correct. To do this, we can divide by the number of ways we can arrange each set of sequences with length n $(c_n!)$ for each sequence length we have.
  2. The cycles are instead selections. To account for this, we can multiply by the number of ways we can arrange the numbers within each cycle $(n-1)!$.
    This gives us the final formula $\frac{n!(a-1)!(b-1)!…(x-1)!}{(n-a-b-…-x)!a!b!…x!c_2!c_3!…} = \frac{n!}{(n-a-b-…-x)! \times ab…x \times c_2!c_3!…}$. This is how I derived the formula.

5) Can you find examples of 7-permutators which 7 have loop lengths of 3, 4, 5 and 6?

$\begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 \ 2 & 3 & 1 & 4 & 5 & 6 & 7\end{pmatrix}$ has a loop length of 3. $\begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 \ 2 & 3 & 4 & 1 & 5 & 6 & 7\end{pmatrix}$ has a loop length of 4. $\begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 \ 2 & 3 & 4 & 5 & 1 & 6 & 7\end{pmatrix}$ has a loop length of 5. $\begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 \ 2 & 3 & 4 & 5 & 6 & 1 & 7\end{pmatrix}$ has a loop length of 6.

6) Are there ‘different ways’ of obtaining 7-permutators with a given loop length (such as 6)?

Yes. You can have $7\langle 2,3\rangle$ or $7\langle 6\rangle$.

7) What is the total number of 7-permutators with loop length 7?

This is all $7\langle 7\rangle$. The number is $\frac{7}{0!\times7\times1!} = 6! = 720$.

8) What is the total number of 7-permutators with loop length 5?

This is all $7\langle 5\rangle$. The number is $\frac{7!}{2!\times5\times1!} = 504$.

9) What is the maximum possible loop length of a 7-permutator?

It is 12.

Bonus) What is the number of $n$-permutators with loop length $l$?

Oh god. First we have to get all of the sets of cycle lengths which have a LCM of $l$ and which add to less than $n$.


home