Find $x$ and $y$ where $20!=\overline{24329020081766xy\dots}$(without using calculator.)

My attempt:I first find how many zeroes does it have: $$\left\lfloor {\frac{20}{5}} \right\rfloor=4.$$

It can be solved easily if we know that after $y$ there are only three digits then we can know: $$y=0.$$

Then $\overline {6x}$ is divisible by $4$ which gives us: $$x=4\ \ \ \text{ or }x=8.$$

Then if we check divisiblity role of $8$ we will get that $\overline {66x}$ is divisible by $8$ that tells to us $x$ can only be $4$. Thus $$x=4.$$

But know the biggest problem is that we don't know how many digits are there after $y$.

Or in a bigger amount how many digits are there in $20!$.


  • $\begingroup$ Mind clarifying (or elaborating on) the meaning of $\overline{24329020081766xy\dots}$? $\endgroup$ – barak manos Aug 11 '16 at 19:41
  • $\begingroup$ @barakmanos I interpret it as saying "we know the first fourteen digits of $20!$ (read from left to right) are $24329020081766$. Knowing this and other properties of the factorial, find the fifteenth and sixteenth digits without using a calculator" $\endgroup$ – JMoravitz Aug 11 '16 at 19:45
  • 2
    $\begingroup$ wolframalpha.com/input/?i=20! That's a web-site, not a calculator. $\endgroup$ – Robert Israel Aug 11 '16 at 19:45
  • 3
    $\begingroup$ @barakmanos I cannot comment on the choice of the way the problem was written, only on what it means. Part of why it might have been written that way is to hide how many digits long the number happens to be. Sneaking a peek at the answer, we see that it is in fact true that after $y$ there are only three more digits, at which point the OP's logic holds and we know that the digits in question are indeed $4$ and $0$ respectively. The question then is how do we know without extensive calculation how many digits long $20!$ is. $\endgroup$ – JMoravitz Aug 11 '16 at 19:52
  • 1
    $\begingroup$ @barak manos The line on it clearfy's that it isn't a multiply it is a digit. $\endgroup$ – Taha Akbari Aug 11 '16 at 19:53

Note that \begin{align}20! & = 2^{18}\cdot 3^8 \cdot 5^4 \cdot 7^2 \cdot 11 \cdot 13 \cdot 17 \cdot 19 \\ & = 2^{18} \cdot 3^8 \cdot 5^4 \cdot 7^2 \cdot (15-4) \cdot (15+4) \cdot (15-2) \cdot (15+2) \\ & = 2^{18} \cdot 3^8 \cdot 5^4 \cdot 7^2 \cdot (15^2 - 4^2) \cdot (15^2 - 2^2) \\ & < 2^{18} \cdot 3^8 \cdot 5^4 \cdot 7^2 \cdot 15^2 \cdot 15^2 \\ & = 2^{18} \cdot 3^{12} \cdot 5^8 \cdot 7^2 \\ & = 2^9 \cdot 9^6 \cdot (2 \cdot 5)^8 \cdot (2 \cdot 7^2) \\ & < 1000 \cdot 10^6 \cdot 10^8 \cdot 100 \\ & = 10^{19}.\end{align}

Therefore $20!$ has at most 19 digits.

Since $20!$ is divisible by $10000$, last four digits are zero.

We are given first $14$ digits of $20!$ (the last digit given being nonzero) and we know that last four digits are zero. Therefore $20!$ has $18$ or $19$ digits. At this point we see that $y=0$.

If $20!$ had 18 digits, then it would be equal to $243290200817660000$. However, this number is not divisible by $9$ (you can verify this by checking the sum of digits). Therefore $20!$ has exactly $19$ digits. Now, using the sum-of-digits-must-be-divisible-by-9 test again we conclude that $x=4$.


Some judicious pairing of the numbers from $1$ to $20$ leads to the rough estimate

$$\begin{align} 20!&=(20\cdot1)(17\cdot3)(19\cdot2)(12\cdot10)(15\cdot4)(18\cdot5)(16\cdot6)(14\cdot7)(13\cdot8)(11\cdot9)\\ &\approx20\cdot50\cdot40\cdot120\cdot60\cdot100\cdot100\cdot100\cdot100\cdot100\\ &\approx1000\cdot5000\cdot60\cdot10^{10}\\ &=10^3\cdot300000\cdot10^{10}\\ &=3\cdot10^{18} \end{align}$$

Some extra work could probably establish rigorous upper and lower bounds


Knowing that $20!$ ends with $4$ $0$'s and counting that there are $14$ digits before the $xy$, we see that $y$ is the first of the trailing $0$'s. Finally, knowing that $9$ divides $20!$, we have


implies $x=4$.

Added later: Here is a second approach, using that fact that $20!$ is divisible by both $9$ and $11$.

We have


so $20!$ has at most $20$ digits. Since it ends in $4$ $0$'s, everything to the right of the $xy$ is a $0$. Using the digit sum test for divisibility by $9$, we get


Using the alternating digit sum test for divisibility by $11$, we get

$$x\equiv4+y\mod 11$$

The restriction $0\le x,y\le9$ makes it easy to check that $x=4, y=0$ is the only solution.


The number of digits can be found using logarithm. You can use a logarithm table to find the number of digits without calculator:

$$\log_{10}(20!)=\sum\limits_{i=1}^{20}\log_{10}(i)\approx 18.38 $$

Therefore that number has 19 digits!


You are almost there. It is also true that $20!$ is divisible by $9$, so the sum of the digits is divisible by $9$ as well. That gives you $x$

  • 2
    $\begingroup$ How does this help the issue of figuring out how many more digits after $y$ there are in the number? Certainly, if you know that there are three digits after $y$ implying that $y=0$ and all digits after $y$ are zero, this gives a faster, cleaner solution for $x$, but in the case that there are ten or twenty more digits after $y$, this doesn't give much information about $x$ and $y$ individually. $\endgroup$ – JMoravitz Aug 11 '16 at 20:31
  • $\begingroup$ @JMoravitz: OP has speculated and SMAD has shown that $y=0$ $\endgroup$ – Ross Millikan Aug 11 '16 at 20:33

Your Answer

