Number Theory – Proof of $6174$ as the Unique 4-Digit Kaprekar’s Constant

elementary-number-theoryproof-verification

I'm studying number theory and I meet this question:

(For those who knows Kaprekar's constant may skip 1st paragraph.)

Let $a$ be an integer with a 4-digit decimal expansion, with not all
digits the same. Let $a'$ be the integer with a decimal expansion
obtained by writing the digits of $a$ in descending order, and let
$a''$ be the integer with a decimal expansion obtained by writing the
digits of $a$ in ascending order. Define $T(a)=a'-a''.$

Show that the only integer with a four-digit decimal expansion with
not all digits the same such that $T(a)=a $ is $a=6174$.

My attempt

Let $a'=\overline{a_4a_3a_2a_1}$, where $a_4\ge a_3\ge a_2\ge a_1$; $a''=\overline{a_1a_2a_3a_4}$.

$a=T(a)=a'-a''=1000(a_4-a_1)+100(a_3-a_2)+10(a_2-a_3)+(a_1-a_4)$

For $a_3=a_2$, $T(a)=\overline{(a_4-a_1-1)99(10+a_1-a_4)}$

As the largest digit of $a$ in this case is $9$, $a_4=a_3=9$,

so $T(a)=\overline{(8-a_1)99(a_1+1)}=8991-999a_1$. But no such pair of $(a_1,a)$ where $a=T(a)$ exists.

Therefore $a_3>a_2$.

$a=T(a)=\overline{(a_4-a_1)(a_3-a_2-1)(9+a_2-a_3)(10+a_1-a_4)}$

For each digit, as they can be rewritten into only $a_1,a_2,a_3$ or $a_4$,

we have:

$$a_4-a_1=a_1/a_2/a_3/a_4\implies10+a_1-a_4=10-a_1/10-a_2/10-a_3/10-a_4$$
$$a_3-a_2-1=a_2/a_1\implies 9+a_2-a_3=10-a_2/10-a_1$$

We now have $2\cdot4=8$ cases to deal with, which need to be solved by brute-force. But I don't like it.

Question

I'm stuck here. Originally I want to prove it as simply/algebraically as possible. Can someone give me some hint to proceed my proof? Or is there any more elegant way to prove it? Thank you.

P.S. I don't want diagram-like explanation, which I see in old posts in related topics.

Best Answer

We write $n=\overline{abcd}$, and as in your question $a_4$ to $a_1$ are the numbers from large to small.

$$a = a_4-a_1$$ $$b = a_3-a_2-1$$ $$c = a_2-a_3+9$$ $$d = a_1-a_4+10$$

We know that $a_4 \geq a_3 > a_2 \geq a_1$. We also know $a+d=10$,$b+c=8$.

We also know $a > b$.

We also know $c \geq d-1$, with equality iff $a_4 = a_3 > a_2 = a_1$, in that case, we can write $n=\overline{eeff}-\overline{ffee}=\overline{(e-f)(e-f)(f-e)(f-e)}$ if $n$ is Kaprekar, but this doesn't statistify $a>b$ and thus it can't be Kaprekar. Therefore $c \geq d$.

We therefore have 6 possibilities for $n=\overline{abcd}$:

It can be $\overline{a_4a_2a_3a_1}$, $\overline{a_3a_2a_4a_1}$, $\overline{a_4a_1a_3a_2}$, $\overline{a_3a_1a_4a_2}$, $\overline{a_2a_1a_4a_3}$ or $\overline{a_4a_3a_2a_1}$.

Case 1. $\overline{a_4a_2a_3a_1}$. In this case we have $a_4=a_4-a_1$, so $a_1=0$. But $a+d=a_1+a_4=10$, so $a_4=10$. Contradiction.

Case 2. $\overline{a_3a_2a_4a_1}$. In this case we have $a_1=a_1-a_4+10$, so $a_4=10$. Contradiction.

Case 3 and 6. $\overline{a_4a_1a_3a_2}$. See case 1.

Case 4. $\overline{a_3a_1a_4a_2}$. This is the case 6174 is in. We have the system:

$$a_3 = a_4-a_1$$ $$a_1 = a_3-a_2-1$$ $$a_4 = a_2-a_3+9$$ $$a_2 = a_1-a_4+10$$

Substitute first in the latter three:

$$a_1 = a_4-a_1-a_2-1$$ $$a_4 = a_2-a_4+a_1+9$$ $$a_2 = a_1-a_4+10$$

Substitute last in the former two:

$$a_1 = a_4-a_1-a_1+a_4-10-1$$ $$a_4 = a_1-a_4+10-a_4+a_1+9$$

Rewrite:

$$3a_1 = 2a_4-11$$ $$3a_4 = 2a_1+19$$

Two times first and three times second added gives:

$$6a_1+9a_4 = 4a_4-22+6a_1+57$$ $$5a_4 =35$$ $$a_4 =7$$

This gives $3a_1 = 14-11=3$ thus $a_1=1$. Filling this in in the first and last original equation gives $a_3=6$ and $a_2=4$. This gives $n=6174$ as Kaprekar number.

Case 5:

$$a_2 = a_4-a_1$$ $$a_1 = a_3-a_2-1$$ $$a_4 = a_2-a_3+9$$ $$a_3 = a_1-a_4+10$$

Substitute first in the second:

$$a_1 = a_3+a_1-a_4-1$$

$$0 = a_3-a_4-1$$

$$a_4+1 = a_3$$

This contradicts the fact that $a_4 \geq a_3$.

This completes the proof. Phew.

Related Question