Let $n$ be a non-zero natural integer. For an integer $k$ at most $n$, we denote by $s(n,k)$ the number of permutations of $\mathfrak{S}_n$ such that $\omega(\sigma) = k$. We consider, on the probability space $(\mathfrak{S}_n, \mathscr{P}(\mathfrak{S}_n))$ equipped with the uniform probability, the random variable $X_n$ defined by $X_n(\sigma) = \omega(\sigma)$. Deduce that $$\frac{1}{n!} \sum_{k=1}^{n} k^2 s(n,k) = \mathbb{E}\left[X_n\right] + \left(\sum_{i=1}^{n} \sum_{j=1}^{n} \frac{1}{ij} - \sum_{i=1}^{n} \frac{1}{i^2}\right).$$
Let $n$ be a non-zero natural integer. For an integer $k$ at most $n$, we denote by $s(n,k)$ the number of permutations of $\mathfrak{S}_n$ such that $\omega(\sigma) = k$. We consider, on the probability space $(\mathfrak{S}_n, \mathscr{P}(\mathfrak{S}_n))$ equipped with the uniform probability, the random variable $X_n$ defined by $X_n(\sigma) = \omega(\sigma)$.
Deduce that
$$\frac{1}{n!} \sum_{k=1}^{n} k^2 s(n,k) = \mathbb{E}\left[X_n\right] + \left(\sum_{i=1}^{n} \sum_{j=1}^{n} \frac{1}{ij} - \sum_{i=1}^{n} \frac{1}{i^2}\right).$$