Tuesday, September 22, 2009

Kaprekar's Constant for four-digit numbers

Suppose, we take a general number in digit form, say a b c d, where a>b>c>d.
So the number actually is (1000a+100b+10c+d).

By our assumption, now we subtract the greatest and least possible numbers:

(1000a+100b+10c+d) - (1000d+100c+10b+a)
= 999(a-d) + 90(b-c)

Now, we need to express this thing in the digit format, if we can do it, then the resulting number will have the permutation of the digits a,b,c,d. This is because, here we are assuming that there is such a constant, in that case the subtraction process will terminate for the constant number, and we can solve equations to obtain it.
If the cases obtained does not satisfy then we will conclude that our assumption was wrong and no such constant number exists...

now, say, (a-d) = x and (b-c) = y.

thus, (999x + 90y)
= 1000x + 100y - 100 + 90 - 10y + 10 - x
= 1000x + 100(y-1) + 10(9-y) + (10-x)
= x (y-1) (9-y) (10-x)
= (a-d) (b-c-1) (9-b+c) (10-a+d)

So, we obtained the digit form, now what's left is to equalise these digits with a,b,c,d and test for solutions. We obtain total 4!=24 cases, out of which only one case satisfies our condition, and that case is:
(9-b+c)>(a-d)>(10-a+d)>(b-c-1)

I am not going in the tedious calculations of disproving the other cases, if anyone is interested he/she may check it. But I checked each of them personally, and they turned out to contain some contradictions...Here I include only the case that determines the Kaprekar's Constant for four-digit numbers.

In our case, a = 9-b+c
b = a-d
c = 10-a+d
d = b-c-1
(if we re-arrange for the greatest possible number)

we rearrange to obtain these four equations...

a+b-c = 9
a-b-d = 0
a+c-d = 10
b-c-d = 1

which further gives the conditions:

a+d = 8
b+c = 10

Now, (a-d)>(10-a+d)
thus, (a-d)>5

so, (a-d)=6 or 7. Since (a+d) is even so (a-d) must be 6, which gives a=7, d=1.

Similarly, (b-c-1)<(9-b+c) thus, (b-c)<5>5=(9-b+c) which is a contradiction to our assumption. So, (b-c) must be 2, which gives b=6, c=4.

Thus, a b c d = 7641. But this may not be the constant, since this was the first assumed number. To determine the constant, we have to subtract the least possible number from it.

So, the Kaprekar's Constant for four-digit numbers is (7641-1467) = 6174.

1 comment: