For how many positive integers n does n! end in exactly 5 0s?

we get a zero when we multiply be a number ending in either 2 and 5 or a 10

at the end of 5! --- one zero
at the end of 10! -- two zeros
at the end of 15! -- 3 zeros
at the end of 20! -- 4 zeros
at the end of 25! -- 5 zeros

e.g.
10! = 10x9x8x7x6x5x5x3x2x1
= 2x5x3x3x2x2x2x7x3x2x5x2x2x3x2
= (2^8 x 5^2) x 3^4 x 7
= 6400 x 567 --- ending in 2 zeros

To determine the number of positive integers n for which n! ends in exactly 5 zeros, we need to understand how zeros are formed at the end of a number when factorials are taken.

A zero at the end of a number is formed when the number is multiplied by 10 or any power of 10 (10, 100, 1000, and so on). So, instead of counting the number of zeros, we can count the number of times a factorial is divisible by 10 or a power of 10.

A factorial is divisible by 10 when it has factors of both 2 and 5. This is because 10 can be factored as 2 * 5. Since there are more factors of 2 in a factorial compared to factors of 5, we only need to count the number of factors of 5 in the factorial.

Let's break this down further:

- For a number n, the number of factors of 5 in n! is given by n/5.
- However, this only considers the number of single factors of 5. We also need to consider numbers with multiple factors of 5, like 25 (which has two factors of 5 - 5 * 5) or 125 (which has three factors of 5 - 5 * 5 * 5), and so on.
- To account for these multiple factors of 5, we divide n by 5^2, 5^3, and so on.

Now, let's find the largest value of n for which n! ends in exactly 5 zeros.

Step 1: Find the number of factors of 5 in n! (considering only single factors of 5)
The largest power of 5 that divides n! is n/5. However, n/5 may contain some numbers with multiple factors of 5, so we need to account for them in the subsequent steps.

Step 2: Find the number of factors of 5^2 in n!
The largest power of 5^2 that divides n! is n/5^2.

Step 3: Continue this process for higher powers of 5.

The final number of factors of 5 in n! will be the sum of the factors of 5, factors of 5^2, factors of 5^3, and so on, until we get a factor less than 5.

Now, let's solve the problem:

We want n! to end in exactly 5 zeros, which means we need to find the smallest n for which the number of factors of 5 in n! is 5.

The simplest way to solve this problem is by trial and error. Let's check for various values of n:

For n = 5: n/5 = 1, so one factor of 5.
For n = 10: n/5 = 2, so two factors of 5.
For n = 15: n/5 = 3, so three factors of 5.
For n = 20: n/5 = 4, so four factors of 5.
For n = 25: n/5 = 5, so five factors of 5.
For n = 30: n/5 = 6, so six factors of 5.
For n = 35: n/5 = 7, so seven factors of 5.
For n = 40: n/5 = 8, so eight factors of 5.
For n = 45: n/5 = 9, so nine factors of 5.
For n = 50: n/5 = 10, so ten factors of 5.

So, the smallest value of n for which n! ends in exactly 5 zeros is 25.

We can also generalize this method:
- Set up an equation (n/5 + n/5^2 + n/5^3 + ...) - which represents the number of factors of 5 - equal to the desired number of zeros.
- Solve the equation to find the value of n.

In this case, we need 5 zeros, so the equation would be:

n/5 + n/5^2 + n/5^3 + ... = 5

By solving this equation, we will obtain the same result: n = 25.