How many zeroes at the end of binary representation of 50!

845 Views Asked by At

enter image description here

The answers don't make sense to me. The binary number of 50 is 110010. Do I overlook something?

2

There are 2 best solutions below

0
On

The number of zeroes at the end of $n$ in base $k$ notation is the highest power of $k$ that divides $n$. This is very elementary proof.

Now, the highest power of $2$ that divides $50!$ can be calculated as:
$\sum\limits_{i = 1}^\infty\lfloor\frac{50}{2^i}\rfloor = \lfloor\frac{50}{2}\rfloor + \lfloor\frac{50}{4}\rfloor + \cdots = 25 + 16 + 6 + 3 + 1 = 47$, because the terms $\lfloor\frac{50}{2^6}\rfloor$ and beyond will be $0$.

0
On

Or you can write a simple Python programme to calculate it:

>>> from math import *
>>> bin(factorial(50))
    ....
>>> len('copy and paste here the zero-s at the end')
    47