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
109 in base 3:10910=110013
The exponent of 3 is:
The exponent of 3==n⏞109−(sum of all the digits in the expansion of n in base p⏞1+1+0+0+1)3⏟=p−1The exponent of 3=109−32The exponent of 3=1062The exponent of 3=53