year 10 factorial question

105 Views Asked by At

I would like to know the number of zeros occuring in the factorial of 2016? (2016!) I have read some ways but i don't understand it.

2

There are 2 best solutions below

0
On

A simple approach to the problem would be as follows:

  • $5^1$: 2016÷5 = 403.2, so I have 403 factors of 5
  • $5^2$: 2016÷25 = 80.64, so I have 80 factors of 25
  • $5^3$: 2016÷125 = 16.128, so I have 16 factors of 125
  • $5^4$: 2016÷625 = 3.22, so I have 3 factors of 625
  • $5^5$: 2016÷3125 < 1, so I stop here.

In total, I now have 403+80+16+3 = 502 trailing zeroes.

1
On

In order to find the number of trailing zeros you need to determine how many times $10$ divides $2016!$. In order for a factor of 10 to be present you need a (prime) factor of $2$ and a (prime) factor of $5$. So think about how many number are divisible from $1, 2, 3, ..., 2016$ are divisible by $5$? There are $\lfloor \frac{2016}{5}\rfloor$ of them. But this is not all. Some numbers are divisible by 5 twice (i.e. multiples of 25). How many multiples of 25 are there (1 extra prime factor for each multiple)? There are $\lfloor \frac{2016}{25}\rfloor$ of them. Some of those numbers are also divisible by 5 three times (i.e. multiples of 125). Find the number of those in the same way. Follow this procedure until $5^{k} > 2016$. Add up all those values and you have the number of times $5$ appears as a factor. You can similarly count how many times $2$ occurs, but all you need to be certain of is that $2$ occurs at least as many times as $5$ does (I'll leave this to you to determine, not hard).