For a prime \(p>n\) for \(n\in\mathbb{N}\), you've probably seen this formula somewhere for the highest power of \(p\) dividing \(n!\):

\[\displaystyle \sum _{ i\ge 1 }^{ \quad }{ \left\lfloor \frac { n }{ { p }^{ i } } \right\rfloor } \]

In fact, there's a much more surprising formula (let's face it, this one isn't that hard to derive): suppose \(n={ ({ b }_{ 0 }{ b }_{ 1 }{ b }_{ 2 }...{ b }_{ r }) }_{ p }\), or

\[n={ b }_{ 0 }{ p }^{ r }+{ b }_{ 1 }{ p }^{ r-1 }...+{ b }_{ r }\]

and let \(\delta (n)\) be the digit sum of \(n\) base \(p\). Then the highest power of \(p\) dividing \(n!\) is

\[\displaystyle \frac { n-\delta (n) }{ p-1 } \]

Wow. That's a heck of a lot shorter, isn't it? But why does this even work? Let's prove it below...

\[\frac { n-\delta (n) }{ p-1 } = \frac { n-({ b }_{ 0 }+{ b }_{ 1 }+...{ b }_{ r }) }{ p-1 } =\frac { \displaystyle \sum _{ k=0 }^{ r }{ { b }_{ k }({ p }^{ r-k }-1) } }{ p-1 } \]

Then factor \({p}^{r-k}-1\) (by difference of nth powers) and cancel the \(p-1\) in the denominator. This results in

\[\displaystyle \sum _{ k=0 }^{ r }{ { b }_{ k }\left( 1+p+{ p }^{ 2 }...{ p }^{ r-k-1 } \right) } = b_{r-1}+(b_{r-2}p+b_{r-2}) \dots\]

Now write this sum out - term by term - in columns (not a typo, I mean columns - there's a trick here):

\[\displaystyle \sum _{ k=0 }^{ r }{ { b }_{ k }\left( \sum _{ j=0 }^{ r-k-1 }{ { p }^{ j } } \right) } =({ b }_{ r-1 }+{ b }_{ r-2 }p+\dots+ { b }_{ 0 }{ p }^{ r-1 })\] \[\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad+(b_{r-2}+ \dots + b_0 p^{r-2})\] \[\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\] \[\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad +b_0\]

Okay, while each term was written by column before, let's look at the rows now. In fact, each row is equal to a term in this familiar expression:

\[\displaystyle \sum _{ k=1}^{ r }{ \left\lfloor \frac { n }{ { p }^{ k } } \right\rfloor } \]

because each time you divide by \(p\) again one term in the base \(p\) expansion vanishes (that associated with \(p^0\)) and the others go down an exponent of \(p\). So, we have

\[\displaystyle \sum _{ k=1}^{ r }{ \left\lfloor \frac { n }{ { p }^{ k } } \right\rfloor } = \displaystyle \frac { n-\delta (n) }{ p-1 } \]

## Comments

Sort by:

TopNewestWow! Nice, let me see whether I can apply to this question.

Log in to reply