10

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.

Bill Dubuque
  • 282,220
Mythomorphic
  • 6,128
  • 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

3 Answers3

11

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,726
  • 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
2

Let $n$ be the number formed by rearraging the digits of a Kaprekar constant into descending order, namely $a,b,c,d$.

If $b=c$ then the digits of $T(n)$ are $a-d-1,9,9,10+d-a$. Thus $n$ has a digit sum of $27$ and $a=b=c=9$. Then $n=9990$ and $T(n)=8991$, a contradiction.

Otherwise, the digits of $T(n)$ are $a-d,b-c-1,9+c-b,10+d-a.$ One pair of these sum to $10$ and the other pair sum to $8$ and so $a+b+c+d=18$. Clearly $a-d>b-c-1$ and $10+d-a>d$ and so there are two possibilities for the least digit $d$.

If $d=9+c-b$ then $(9-b)+(c-d)=0$ and so $b=9$. Then $a=9$ and $n=9900$ has no pair of digits summing to $8$.

If $d=b-c-1$ then $a+b+c+d=18$ simplifies to $a+2b=19$. Therefore $n$ is either $95**$ or $76**$. For pairs of digits summing to $8$ and $10$ the possibilities are $$9531,7632,7641.$$ The only solution is $T(7641)=6174$.

user1172706
  • 2,791
-1

There is an apparent problem with this argument if a3 = a2 because b is then negative and so cannot be a digit in abcd. The inequality a>b is then violated.

Example: 7443 => a4=7, a3=4, a2=4, a1=3 Hence b = 4-4-1 = -1 < 0 so b in abcd is invalid And a > b is violated because abcd = 4(-1)96 is actually 3996 and 3 is not > 9.

Even if we insist that a3 > a2 in our starting number, this is not guaranteed for its iterates. Example: 8271, for which a3 > a2, yields 7443 as the first iterate, for which a3=a2.

How serious a problem is this?

Any legitimate iterate obviously satisfies b > or = 0. Hence a3-a2-1 > or = 0. Hence a3-a2 > or = 1 for the previous iterate. And its b again satisfies b > or = 0. Hence for all previous iterates, a3-a2 > 0, being 1 greater than b for the following iterate, unless and until that b=9 when a3-a2 becomes 0 (=10 mod 10). Example: 3996 above, for which b=9, has previous iterate 7443, for which a3-a2=0 (=9+1-10).

Further, KC, being an invariant under the Max-Min process, has equal b for all its iterates.

So provided that its b is not 9, we can perhaps just deduce that a3-a2 > 0 for it and hence that use of the formula b = a3-a2-1 is logically consistent as a means of solving for its a4, a3, a2 and a1.

The formulas for a, c and d raise no similar issues because they are all clearly non-negative (the case in which all 4 digits are equal having been excluded).