
Primes help
I need help with this question please!
Create a formula (using sigma, logs, floor function) that computes the exponent of any particular prime in the prime factorization of a given factorial.
we use the notation
exp(p, n!) = the exponent of prime p in the prime factorization of n!
Example: exp(5, 25!) = 6
help please!

A Simple Formula
$\displaystyle exp(p, n!) = \sum_{i=1}^{\infty} \lfloor \frac{n}{p^i}\rfloor$
For example, 625! contains 125 multiples of 5, 25 multiples of 25, 5 multiples of 125, and 1 multiple of 625, thus $\displaystyle exp(5, 625!) = 125+25+5+1 = 156$ .
If you're actually going to use this in practice, the $\displaystyle \infty$ is not necessary. Since $\displaystyle \lfloor \frac{n}{p^i}\rfloor = 0 $ for $\displaystyle n<p^i$ , you only have to sum up to $\displaystyle i=\lfloor \frac{ln(n)}{ln(p)} \rfloor$ , but that doesn't make for as pretty of a formula.