TITLE: Proportion of elements of prime order $p$ in $S_n$
QUESTION [6 upvotes]: I was trying to answer the following question recently : What is the proportion of elements of order $p$ in the symmetric group $S_n$ , where $p$ is some prime number ?
I managed to work out that in general, the number of elements of order $p$ in $S_n$ is:
$ n \choose p   $$(p-1)! +$$\displaystyle  \sum_{k=2}^{[\frac{n}{p}]} \frac{n!}{k!p^k}$
Where $[x]$ is the greatest integer less than or equal to $x$.
Using this, as well as the Taylor series at $x=0$ for $\large e^{\frac{1}{p}}$, I was able to determine that the proportion of elements of order $p$ in $S_n$ as $n \to \infty$ is:
$\displaystyle  \sum_{k=2}^{\infty} \frac{1}{k!p^k} = \large e^{\frac{1}{p}} - \small \frac{p+1}{p}$ 
I was wondering what significance, if any, this has - it feels somewhat similar to the result that states that the limit of the ratio of the number of derangements of $n$ elements to $n!$ is $\frac{1}{e}$, but admittedly I don't fully understand the significance of this result either.
Any help would be much appreciated.
Thanks!

REPLY [2 votes]: There is a well-known formula for the generating function of the proportion of elements of order $1$ or $p$ in $S_n$, i.e., the proportion of $g$ in $S_n$ that satisfy $g^p = 1$. Letting $c_n$ be the number of such solutions, with the convention that $c_0 = 1$, the generating function is 
$$
\sum_{n\geq 0} \frac{c_n}{n!}x^n = e^{x+x^p/p}.
$$
In particular, since this series converges at $x=1$, the proportion $c_n/n!$ tends to $0$, so you are making an error when you say the proportion has a positive limit as $n\rightarrow \infty$. 
Counting the number of elements of order $1$ or $p$ in $S_n$ is the same as counting homomorphisms from $\mathbf Z/(p)$ to $S_n$. More generally, for any finite group $G$ we have 
$$
\sum_{n\geq 0} \frac{\#{\rm Hom}(G,S_n)}{n!}x^n = e^{\sum_{H\subset G} x^{[G:H]}/[G:H]},
$$
where we make the convention that $S_0$ is trivial and the sum in the exponent on the right runs over all subgroups $H$ of $G$. Taking $G= \mathbf Z/(p)$ recovers the first formula. This formula goes back to Wohlfahrt. If you google "wohlfahrt group formula" you'll find references to related work.