What is the probability that two random permutations have the same order?

For two random permutations of $n$ letters, let $p_1(n)$ be the probability they are conjugate and $p_2(n)$ be the probability they have the same order. I computed these exactly up to $n=70$. In the following, the blue diamonds are $n^2p_1(n)$ and the red circles are $n^2p_2(n)$.

The ratio $p_2(n)/p_1(n)$ is some sort of weighted average of how many different partitions of $n$ have the same lcm, with popular partitions weighted more. I would have guessed this would slowly increase, but that isn't visible. The wriggliness of $p_2(n)$ presumably reflects the fact that the number of partitions with the same order as a given partition is some complicated arithmetic function.

Maple was struggling by the time it got to $n=70$ but a C program should be able to reach $n=100$ or maybe further.

plots as described


Nice problem! I claim that $\limsup n^2 p(n) = \infty$.

Suppose $k < n/2$ is such that $n-k$ is divisible by $L_k = \text{lcm}(1,2,\dots,k)$. Then if $\pi \in S_n$ has a cycle of length $n-k$ (this happens with probability $1/(n-k)$) then $\text{ord}(\pi) = n-k$, so the probability gets a contribution of $1/(n-k)^2 \geq 1/n^2$ from such $\pi$. Let $K_n$ be the set of all such $k$. Then $p(n) \geq |K_n|/n^2$.

Now the great thing about $n \mapsto K_n$ is that it is "lower semicontinuous on $\widehat{\mathbf{Z}}$". What I mean is this: Suppose $K = K_n$, and let $k = \max K$. Then the condition that $K_n \supset K$ is $L_k$-periodic, so provided we alter $n$ only by multiples of $L_k$, the set $K_n$ can only get bigger. Moreover, note that we would have $n \in K_n$, except for our stipulation that $k < n/2$. It follows that $$ K_{n + L_n} \supset K_n \cup \{n\}. $$ This shows that $|K_n|$ gets arbitrarily large, which proves the claim.

I have no idea about the $\liminf$! The above argument constructs very particular $n$ (of the shape $n_1 + \dots + n_k$, where each $n_i$ is large and highly divisible in comparison with $n_{i-1}$), and the lower bound is very weak besides (roughly $\log^*(n)/n^2$), so it's tempting to conjecture that the $\liminf$ is finite. But I'm not sure this is supported by the numerics. From the numerics it just looks like we're forgetting something.


That the probability is at least $O(1/n^2)$ is immediate, since the probability that both permutations are $n$-cycles is $1/n^2.$ For the upper bound, there is a convergence speed estimate by Zacharovas, see in particular theorems 3 and 4, which should give you what you want.