We can ask the question: how many times does a prime $p$ divide into a factorial $n!$ until $p$ does not divide $n!$ any more? This is called the $p$-adic valuation or order of $p$ in $n!$. Interestingly, there is a nice formula for this called Legendre’s formula, which relies on a counting argument. Legendre’s formula is presented as an infinite sum of floor functions where all terms of sufficiently high index are zero, so it is actually finite. We prove the formula in this video, and present a second form in terms of base-$p$ digits without proof.