Originally Posted by

**PaulRS** Note that in the set $\displaystyle

S_n = \left\{ {1,2,...,n} \right\}

$ there are $\displaystyle

\left\lfloor {\tfrac{n}

{p}} \right\rfloor

$ multiples of $\displaystyle p$. But $\displaystyle

\left\lfloor {\tfrac{n}

{{p^2 }}} \right\rfloor

$ of these, are multiple of $\displaystyle

p^2

$ and so on.

You must count once the numbers which are multiples of p but not of p², twice the numbers which are multiple of p² and not of p³,... , in order to get the maximum power of p dividing n!

And to do so it's enough to sum $\displaystyle

\left\lfloor {\tfrac{n}

{p}} \right\rfloor + \left\lfloor {\tfrac{n}

{{p^2 }}} \right\rfloor + ...

$