Hello CPhill,
"how was that method derived":
1.)
This is the Legendre Theorem from 1808:
Source: Legendre's Theorem - The Prime Factorization of Factorials https://www.cut-the-knot.org/blue/LegendresTheorem.shtml
2.)
There is a second nice Theorem from Legendre to solve this problem:
Source: Legendre's Theorem - The Prime Factorization of Factorials https://www.cut-the-knot.org/blue/LegendresTheorem.shtml
Example:
The prime factorization of 109! So \(n = 109\)
What is the exponent of 3? So \(p = 3\)
\(\begin{array}{|rcll|} \hline 109 \text{ in base } 3: \\ 109_{10} = 11001_3 \\ \hline \end{array} \)
The exponent of 3 is:
\(\begin{array}{|rcll|} \hline \text{The exponent of $3$} &=& \dfrac{\overbrace{109}^{=n}-(\overbrace{1+1+0+0+1}^{\text{sum of all the digits in the expansion of $n$ in base $p$}})}{\underbrace{3}_{=p}-1} \\ \text{The exponent of $3$} &=& \dfrac{ 109 - 3}{2} \\\\ \text{The exponent of $3$} &=& \dfrac{ 106}{2} \\\\ \mathbf{\text{The exponent of $3$}} & \mathbf{=} & \mathbf{53} \\ \hline \end{array}\)