# Determining the missing digits of $15! \equiv 1\square0767436\square000$ without actually calculating the factorial

$$15! \equiv 1\cdot 2\cdot 3\cdot\,\cdots\,\cdot 15 \equiv 1\square0767436\square000$$

Using a calculator, I know that the answer is $$3$$ and $$8$$, but I know that the answer can be calculated by hand.

How to calculate the missing digits? I know that large factorials can be estimated using Stirling's approximation: $$15! \approx \sqrt{2\pi\cdot 15} \cdot \left(\frac{15}{e}\right)^{15}$$ which is not feasible to calculate by hand.

The resulting number must be divisible by 9 which means that the digit sum must add up to 9 and is also divisible by 11 which means that the alternating digit sum must be divisible by 11:

$$1+ d_0 + 0 + 7 +6 +7 +4 +3+6+d_1+0+0+0 \mod \phantom{1}9 \equiv \,34 + d_0 + d_1 \mod \phantom{1}9 \equiv 0$$ $$-1+ d_0 - 0 + 7 -6 +7 -4 +3-6+d_1-0+0-0 \mod 11 \equiv d_0 + d_1 \mod 11 \equiv 0$$

The digits $$3$$ and $$8$$, or $$7$$ and $$4$$, fulfill both of the requirements.

• Well, you know that the sum of the digits is divisible by $9$ and the alternating sum of the digits is divisible by $11$. That should tell you what the two digits are, though not their order. But you should be able to argue that the first non-zero digit from the right must be even. – lulu Jan 2 '19 at 21:36
• Why is the sum of the digits divisible by 9? – Stephan Jan 2 '19 at 21:37
• @Darkice because for every natural number $n\geq 6$ you have that $n!$ is a multiple of nine and a natural number is a multiple of nine if and only if the sum of its digits is a multiple of nine. – JMoravitz Jan 2 '19 at 21:41
• Alright, now I know that the digits must add up to a multiple of 9 and must be divisible by 11. So the digits could be 7 and 4 or 3 and 8 which would both fulfil the requirements. – Stephan Jan 2 '19 at 21:59
• For your specific case, one of the numbers you are looking to find is the final nonzero digit. As $15! = 2^{11}\cdot3^6\cdot5^3\cdot7^2\cdot11\cdot13$ the final nonzero digit will be $2^8\cdot3^6\cdot7^2\cdot11\cdot13\pmod{10}$ which is a much easier calculation to do modulo 10 than fully expanding out the product. $2^8\cdot3^6\cdot7^2\cdot11\cdot13\equiv 6\cdot 9\cdot 9\cdot 1\cdot 3\equiv 8\pmod{10}$. This would be admittedly more difficult if both of the numbers were located further in the middle and not next to the trailing zeroes. – JMoravitz Jan 2 '19 at 22:09

Another way to reason is to note that $$15!$$ is divisible by $$2\cdot4\cdot2\cdot8\cdot2\cdot4\cdot2=2^{11}$$, which means $$1\square0767436\square$$ is divisible by $$2^8$$. In particular, it's divisible by $$8$$. But since $$8\mid1000$$ and $$8\mid360$$, the final $$\square$$ must be either $$0$$ or $$8$$. But it can't be $$0$$, since $$15!$$ has only three powers of $$5$$ (from $$5$$, $$10$$, and $$15$$), and those were already accounted for in the final three $$0$$'s of the number. Thus the final $$\square$$ is an $$8$$. Casting out $$9$$'s now reveals that the first $$\square$$ is a $$3$$.

Remark: It wasn't strictly necessary to determine the exact power of $$2$$ (namely $$2^{11}$$) that divides $$15!$$, merely that $$2^6$$ divides it, but it wasn't that hard to do.

You can cast out $$9$$’s and $$11$$’s: \begin{align} 1+x+0+7+6+7+4+3+6+y+0+0+0&=x+y+34 \\ 1-x+0-7+6-7+4-3+6-y+0-0+0&=-x-y \end{align} Thus $$x+y=11$$ (it can't be $$x=y=0$$).

Then find the remainder modulo $$10000$$; since $$15!=2^{11}\cdot 3^6\cdot 5^3\cdot 7^2\cdot11\cdot13=1000\cdot 2^8\cdot3^6\cdot7^2\cdot 11\cdot 13$$ this means finding the remainder modulo $$10$$ of $$2^8\cdot3^6\cdot7^2\cdot 11\cdot 13$$ that gives $$8$$ with a short computation.

Using the divisibility rule for 7 the answer boils down to 3 and 8:

$$-368+674+307+1 \mod 7 \equiv 0$$

• for the order problem you could remove three zeros from the Least significant digit side and say it still needs to be divisible by 2 or 4 cause there are lots of 2's and 4's in the original multiplication, so 3 couldn't be on the right side. – no0ob Jan 2 '19 at 23:34
• The order is also given by the divisibilty rule for 7. – Stephan Jan 3 '19 at 8:54

Okay, $$15! = 1*2*3..... *15=1a0767436b000$$.

Why does it end with $$000$$? Well, obviously because $$5,10,15$$ all divide into it so $$5^3$$ divides into it and at least three copies of $$2$$ divid into it so $$2^3*5^3 =1000$$ divide into it.

If we divide $$15!$$ by $$100 = 8*5^3$$ we get

$$1a0767436b = 1*2*3*4*6*7*9*2*11*12*13*14*3$$

If we want to find the last digit of that we can do

$$1a0767436b \equiv b \pmod {10}$$ and

$$1*2*3*4*6*7*9*2*11*12*13*14*3\equiv 2*3*4*(-4)*(-3)*(-1)*2*1*2*3*4*3\equiv$$

$$-2^9*3^4 \equiv -512*81\equiv -2 \equiv 8\pmod {10}$$..

So $$b = 8$$.

But what is $$a$$?

Well, $$11|1a0767436b$$ and $$9|1a0767436b$$.

So $$1+0+6+4+6 - a - 7-7-3-b = 11k$$ for some integer $$k$$. And $$1+a+0+7+6+7+4+3+6+b = 9j$$ for some integer $$j$$.

So $$-a -8 =11k$$ so as $$0\le a \le 9$$ we have $$a = 3$$.

And that's that $$15! = 1307674368000$$..... IF we assume the person who asked this question was telling the truth.

We do know that $$15!$$ ends with $$.... 8000$$ but we are completely taking someone elses word for it that it begins with $$1a0767436....$$

Let $$d_1$$ and $$d_2$$ be the two unknown digits.

The number must be divisible by $$8000$$, because $$15!$$ contains $$8$$ and $$1000$$.

$$d_2$$ is non-zero number, because $$15!$$ contains only three $$5$$s. It implies $$1d_10767436d_2$$ must be divisible by $$8$$. It implies $$36d_2$$ is divisible by $$8$$. Hence, $$d_2=8$$.

Now you can use the divisibility by $$9$$ ($$d_1+d_2=11$$) and find $$d_1=3$$.

$$15!=2^{11}\cdot 5^3\cdot 7^2\cdot 11\cdot 13=(1000)X$$ where $$X=2^8\cdot 3^6\cdot 7^2\cdot 11\cdot 13.$$

The last digits of $$2^8(=16^2), 3^6 (=9^3),7^2, 11,13$$ are, respectively $$6,9,9,1,3 .$$

Modulo $$10$$ we have $$6\cdot 9\cdot 9 \cdot 1\cdot 3\equiv 6\cdot(-1)^2\cdot 3\equiv 18\equiv 8$$. So the last digit of $$X$$ is an $$8$$.

Therefore the 2nd digit of $$15!$$ must be a $$3$$ in order for the sum of all its digits to be divisible by $$9$$.