2
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ Number of trailing zeros or the total number of them? Because the second one is way harder. $\endgroup$ – rubik Jul 27 '16 at 15:10
  • $\begingroup$ According to the PARI/GP program ? q=0;x=digits(2016!);for(j=1,length(x),if(x[j]==0,q=q+1));print(q) 1006 ? , $2016!$ contains $1006$ zeros. The number of trailing zeros is $502$. $\endgroup$ – Peter Jul 27 '16 at 15:11
  • $\begingroup$ total number. No wonder...the one i searched about were the solutions to the trailing zeros $\endgroup$ – 1234 Jul 27 '16 at 15:11
  • 2
    $\begingroup$ The easiest way to find the number of trailing zeros : Divide $2016$ repeatedly by $5$ ignoring the remainder until you arrive at $0$ and add all occuring numbers (except $2016$, of course). You get the sequence $403,80,16,3,0$ , which sums up to $502$. $\endgroup$ – Peter Jul 27 '16 at 15:19
  • 2
    $\begingroup$ The idea is quite simple : You have to count how many numbers from $1$ to $n$ are divisble by $5$, by $5^2$ , by $5^3$ and so on until we reach a power of $5$ greater than $n$ (here, the number is $0$). There are $n_1=trunc(n/5)$ numbers from $1$ to $n$ divisble by $5$, so we start with $n_1=trunc(n/5)$. $n_2=trunc(n_1/5)$ of these numbers are divisble by $5^2$, the exponent in $5^m$ will increase by $n_2$ because we already covered exponent $1$ with $n_1$. You can continue until $n_k=0$ and the sum of the $n_i$'s is the desired number. $\endgroup$ – Peter Jul 27 '16 at 16:14
2
$\begingroup$

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).

$\endgroup$
  • $\begingroup$ There may be a nicer "number theory" way to do this. This is a "combinatorial" way to solve it. $\endgroup$ – TravisJ Jul 27 '16 at 16:14
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.