# Why does $987,654,321$ divided by $123,456,789 = 8$?

Why does $987,654,321$ divided by $123,456,789 = 8$?

Is it a coincidence or is there a special reason?

Note: The numbers are a mirror of each other

• cannot be exactly 8, both numbers odd; if the ratio were an integer, it would be an odd integer – Will Jagy Jan 19 '17 at 23:32
• Why is $2178 * 4 = 8712$? Note: The numbers are a mirror of each other. (And this is actually true, while your relation is not, for reasons given below) – астон вілла олоф мэллбэрг Jan 19 '17 at 23:32
• unexpected things can happen when you make up your own rules for division – Jorge Fernández Hidalgo Jan 19 '17 at 23:33
• $\frac{987654321}{123456789}=8.00000007$ – Michael McGovern Jan 19 '17 at 23:35
• This is answered as part of the answers to this: math.stackexchange.com/questions/396135/… – marty cohen Jan 20 '17 at 0:31

$987654321 - 8 \cdot 123456789 = 9$ or $$\frac{987654321}{123456789} = \; 8 \; + \; \frac{1}{13717421} = \; 8 \; + \; \frac{729}{9999999909} \approx 8.0000000729$$ note the $0$ in the tens place in 9999999909

$$123456789*8=9876543{\color{red}1\color{red}2}$$

The number changes the last two digits, so that division can't be correct.

• Well, it can't be correct because no number ending in 1 is divisible by $8$... – Thomas Andrews Jan 20 '17 at 0:05
• You're right, but I thought maybe he wrote wrong the product, so that's why I added this post as an answer. – MonsieurGalois Jan 20 '17 at 0:08

I think whatever calculator you did the calculation with made a rounding error. The quotient of your two numbers in question is close to 8, but it is not 8 exactly.

$$123456789*9=1111111101\\ 123456789+987654321=1111111110$$

Just to generalize:

$$\sum_{i=1}^{b-1} ix^{i-1} = \left(\frac{1-x^b}{1-x}\right)'=\frac{(b-1)x^b-bx^{b-1}+1}{(x-1)^2}$$

Letting $b=x=10$ you get:

$$987654321=\frac{9\cdot 10^{10}-10\cdot 10^9 + 1}{9^2}=\frac{8\cdot 10^{10}+1}{9^2}$$

Then $123456789-111111111 = 999999999-987654321$ so \begin{align}123456789&=10\frac{10^{9}-1}{9}-\frac{8\cdot 10^{10}+1}{9^2}\\ &=\frac{10^{10}+1-90}{9^2}\end{align}

So $$987654321-8\cdot 123456789 = \frac{1+8\cdot (10^2-9)}{9^2}=9$$

More generally, in base $b$:

$$A=((b-1)(b-2)\cdots 1)_b = \frac{(b-2)b^b+1}{(b-1)^2}$$

And:

\begin{align}B&=(123\cdots (b-1))_b \\ &= \frac{b^b-b}{b-1} - \frac{(b-2)b^b+1}{(b-1)^2}\\ &=\frac{b^b-(b^2-b+1)}{(b-1)^2} \end{align}

Then $$A-(b-2)B= \frac{1+(b^2-b+1)(b-2)}{(b-1)^2}=b-1$$

So $$\frac{A}{B} =b-2 + \frac{(b-1)^3}{b^b-(b^2-b+1)}$$ and you have that $$\frac{(b-1)^3}{b^b}<\frac{(b-1)^3}{b^b-(b^2-b+1)}<\frac{(b-1)^3}{b^b} + \frac{1}{b^{2b-5}}$$

So, at least for $b$ large enough, you get about $b-3$ zeros followed by the digits of $(b-1)^3$. So the quotient $\frac{987654321}{123456789}\approx 8.00000007290000$, the fact that $729=9^3$ is not some numerical accident.

For instance, we know when $b=8$ that:

$$\frac{(7654321)_8}{(1234567)_8}\approx (6.00000527...)_8$$ since $(527)_8=7^3$.