# Zeros at the end

1. Jun 23, 2012

### Kartik.

We want to know how many zeros appear at the end of the number 'N' = 1962!
In the solution of it,
We break the number N in a prime numbers notation and which looks like N = 2^a1 x 3^a2 x 5^a3.....p^a(n), so as the question the asks about the zeros in the the product we are concerned about the numbers a1 and a3, as for now because they yield a zero and also about those factors of N which will yield them too.To determine a3, we take that every factor of N divisible by 5 will yield one 5 and so the number of such factors will be 1962/5(and that is my question?) .
What exactly will the 1962/5 provide us with?

2. Jun 23, 2012

### haruspex

You also need to consider some of those numbers are divisible by 25, 125...

3. Jun 23, 2012

### oli4

Hi kartik
1962! is 1*2*3*...*1962
so just look at this sequence of numbers:
1, 2, 3, 4, 5, ...9, 10, ..., 14, 15, ...1960, 1961, 1962
As you can see, you have a '5'... every 5 steps :)
So 1962/5 is how many times you will get a factor 5 and this is a3

Cheers...

4. Jun 23, 2012

### haruspex

No, a3 will be more than that. See my previous post.

5. Jun 23, 2012

### oli4

Yes you are correct haruspex, your post wasn't there while I was posting mine
Indeed, the higher powers of 5 must be considered too, fortunately there are not too many of them and they can be added in by hand

6. Jun 23, 2012

### Infinitum

What haruspex said in general can be formed up as a sum. Say for n!

$$Q = \left [\frac{n}{5} \right ] + \left [ \frac{n}{5^2} \right ] + \left [ \frac{n}{5^3} \right ] + ...... \left [ \frac{n}{5^t} \right ]$$

Q is the number of times the factorial can be divided by 5, and hence 10.

The sum ends(or each term becomes 0) when 5t exceeds n.

This in fact, is a particular case to obtain the number of prime divisors of any positive integer factorial.

7. Jun 24, 2012

### Kartik.

" we are concerned about the numbers a1 and a3, as for now because they yield a zero and also about those factors of N which will yield them too"

I did write about the factors which will also yield a 'n' number of 5s and 2s.

Infinitum and oli4 are quite convincing, thank you.

8. Jun 24, 2012

### cocopops12

i asked how many trailing zeroes does the factorial of 1 million have?. I did manage to calculate the # of zeroes in Mathematica, but i wanted to know the theory behind it.

A man answered that you can use "Sterling's asymptotic formula" which is used to approximate factorials at very large values. He managed to find the EXACT number of trailing zeroes i found using Mathematica. i was truly amazed by this :D

http://en.wikipedia.org/wiki/Asymptotic_formula

9. Jun 24, 2012

### sachav

Even for numbers up to 1 million, the sum $\sum\limits_{k=1}^{+\infty} \left\lfloor\dfrac{n}{5^k}\right\rfloor$ only contains 8 terms, namely 200 000, 40 000, 8 000, 1 600, 320, 64, 12, 2, which makes a total of 249 998 trailing zeroes.

10. Jun 24, 2012

### haruspex

For powers of 10 it's really easy. You can sum the series to get (10n-2n)/4. I think whoever claimed to use Sterling's formula was kidding.