TITLE: What is the largest integer value of $n$ for which $8^n$ evenly divides $(100!)$?
QUESTION [7 upvotes]: I know that this may be an unnecessary question, but I am a bit confused. The problem asks for the highest integer $n$ such that $8$ to the power of $n$ is divisible, evenly of course, by $100$. Now, I searched the site, and, in general, it seems that one can use floor function for a problem like this, but this seems to only work for prime numbers possibly. My process, which I realized was incorrect:
The floor function of $100/8 = 12$, and then doing it for the second power would lead to one, and, by adding those up, I acquired thirteen. Of course, after seeing the answer, $32$, I went back to see what was wrong and did the problem slower. I got $12$ numbers from the numbers in $100!$, and then got another $8$ from $2 \times 4$, but, that can be applied for all the multiples of $2$ and $4$ that aren't of $8$. So, essentially, I am wondering if there is a quicker method for calculating this number without specifically counting out the numbers. Thanks in advance!

REPLY [5 votes]: So you're looking for roughly a third of $$n = \sum_{i = 1}^\infty \left\lfloor \frac{m}{p^i} \right\rfloor,$$ where $m = 100$ and $p$ is 2 ($m$ can be any positive integer and $p$ can be any odd prime).
Of course you don't actually have to even try to go to infinity. As soon as you notice $$\frac{m}{p^i} < 1,$$ you can stop the iteration.
The important thing to understand here is that each consecutive number by which you multiply to get a factorial "adds" its prime factors' exponents to the factorial's prime factors' exponents.
For example, $11! = 2^8 \times 3^4 \times 5^2 \times 7 \times 11 \times 13^0 \times 17^0 \times 19^0 \times \ldots$ Since $12 = 2^2 \times 3^{(1)}$, we can just add 2 to 2's exponent and 1 to 3's exponent, to obtain $12! = 2^{10} \times 3^5 \times 5^2 \times 7 \times 11 \times 13^0 \times$ $17^0 \times 19^0 \times \ldots$ And then the factorization of 13! is a simple matter of adding 1 to 13's exponent.
So in the specific case you're looking at, the first question is: how many numbers less than or equal to 100 are even? Half of them, giving you 50. But this doesn't account for how many of them are "doubly even," since they contribute at least 2 each to 2's exponent in the factorization of 100! So there's 25 of those, bringing our tally up to 75.
And then twelve of them are divisible by 8 (tally's 87 now), six are divisible by 16 (tally 93), three are divisible by 32 (tally 96), only one one is divisible by 64 (tally 97), and none are divisible by 128, 256, 512, 1024, etc. (tally stays at 97).
All that's left to do now is to solve $2^{97} = 8^x$, and round down $x$ if necessary.