Monday, 22 September 2014

number theory - How many 0's are at the end of 20!



I'm not exactly sure how to answer this question, any help would be appreciated. After reading this I'm still not sure.




Cheers


Answer



There is a general formula that can be used. But it is good to get one's hands dirty and compute.



If $20!$ seems dauntingly large, calculate $10!$. You will note it ends with two zeros. Multiplying $10!$ by all the numbers from $11$ to $20$ except $15$ and $20$ will not add to the zeros. Multiplying by $15$ and $20$ will add one zero each.



Remark: Suppose that we want to find the number of terminal zeros in something seriously large, like $2048!$. It is not hard to see that this number is $N$, where $5^N$ is the largest power of $5$ that divides $2048!$. This is because we need a $5$ and a $2$ for every terminal $0$, and the $5$s are the scarcer resource.



To find $N$, it is helpful to think in terms of money. Every number $n$ between $1$ and $2048$ has to pay a $1$ dollar tax for every $5$ "in it." So $45$ has to pay $1$ dollar, but $75$ has to pay $2$ dollars, because $75=5^2\cdot 3$. And a $5$-rich person like $1250$ has to pay $4$ dollars.




Let us gather the tax in stages. First, everybody divisible by $5$ pays a dollar. These are $5$, $10$, $15$ and so on up to $2045$, that is, $5\cdot 1, 5\cdot 2,\dots, 5\cdot 409$. So there are $409$ of them. It is useful to bring in the "floor" or "greatest integer $\le x$ " function, and call the number of dollars gathered in the first stage $\lfloor 2048/5\rfloor$.



But many numbers still owe some tax, namely $25,50,75,\dots,2025$. Get them to pay $1$ dollar each. These are the multiples of $25$, and there are $\lfloor 2048/25\rfloor$ of them.



But $125$, $250$, and so on still owe money. Get them to pay $1$ dollar each. We will gather $\lfloor 2048/125\rfloor$ dollars.



But $625$, $1250$, and $1875$ still owe money. Gather $1$ dollar from each, and we will get $\lfloor 2048/625\rfloor$ dollars.



Now everybody has paid up, and we have gathered a total of

$$\lfloor 2048/5\rfloor + \lfloor 2048/25\rfloor +\lfloor 2048/125\rfloor +\lfloor 2048/625\rfloor$$
dollars. That's the number of terminal zeros in $2048!$.


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...