Legendre's Theorem

Theorem
Let $n \in \Z_{>0}$ be a (strictly) positive integer.

Let $p$ be a prime number.

Let $n$ be expressed in base $p$ representation.

Let $r$ be the digit sum of the representation of $n$ in base $p$.

Then $n!$ is divisible by $p^\mu$ but not by $p^{\mu + 1}$, where:
 * $\mu = \dfrac {n - r} {p - 1}$

Proof
$n$ can be represented as:

Using De Polignac's Formula, we may extract all the powers of $p$ from $n!$.


 * $\mu = \displaystyle \sum_{k \mathop > 0} \floor {\dfrac n {p^k} }$

where $\mu$ is the multiplicity of $p$ in $n!$:
 * $p^\mu \divides n!$
 * $p^{\mu + 1} \nmid n!$

We have that:

Thus:

Hence the result.