9

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.

Mythomorphic
  • 6,008
  • Could someone help me to solve this problem? I've already shown my effort, but not enough attention is received. – Mythomorphic Jun 22 '15 at 12:31
  • Of course, we could just find T(n) for $1000\le n\le 9999$ and see that $n=6174$ is the only solution. – Teoc Jun 22 '15 at 17:38
  • @VladimirLenin It is not hard to see that $a+d=10$, $b+c=8$, this reduces the number of cases form 9000 to 72. – wythagoras Jun 22 '15 at 17:40
  • @Mythomorphic If you are still a fan of $6174$ you may take a look at a fresh answer to a Kaprekar question which is quite parallel to yours. – Hanno Nov 02 '20 at 06:27

1 Answers1

9

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.

wythagoras
  • 25,026
  • It seems that when $a_4=a_3>a_2=a_1$, $c-d-1=a_2-a_1-a_3+a_4+9-10-1=-2$, which contradicts with your point $c\ge d+1$...Is it incorrect? – Mythomorphic Jun 22 '15 at 17:23
  • Do you mean $c\ge d-1$? But then how we have $c\ge d$? – Mythomorphic Jun 22 '15 at 17:30
  • @hkmather802 Yes, $c \geq d-1$, this was a typo. The proof is actually based on $c=d-1$. Then we have $a_1-a_4=a_2-a_3$, But $a_2 \geq a_1$ and $-a_4 \geq -a_3$, thus only possibility is equality in the two inequalities in this sentence. – wythagoras Jun 22 '15 at 17:39
  • thx I get it now and thank you for your proof:) Btw is it again a typo in your comment: $-a_3\ge -a_4$? (It doesn't matter, though). – Mythomorphic Jun 23 '15 at 00:31
  • 1
    @wythagoras Why do You assume that $a_4 \geq a_3 ?>? a_2 \geq a_1$? If we take $n = 1000$ then of course it's not true. – Interpolated Feb 04 '21 at 12:44
  • I would also like to know about @Wywana's question. – Andrew Cheong Jun 29 '22 at 21:12