### The mysterious 6174 revisited

From my earlier post on 6174 comes a simpler 3 digit variant. Select 3 integers which are not all the same. Arrange these digits to form the largest and smallest numbers and subtract them. Repeat this process with the result. For instance,

981-189=792

972-279=693

963-369=594

954-459=495

You will end up with 495!

The following gives a proof that all 3 digit numbers which are not 0,111,222,333,...,999 will end up with 495. This proof can be adapted to 4 digits as well, as in the case of 6174.

Let x,y,z be 3 digits such that z is the largest while x is the smallest, and x,y and z are not all equal. Then if we subtract the largest number formed from the smallest number formed, we have

zyx

- xyz

ABC

Since x < z

C=10+x-z,

Also,

B=10+y-1-y

And

A=z-1-x

Hence B = 9 = z since z is the largest digit. We want A and C to be either x or y. Solving, we see that x=4 and y=5. Hence 495 is the only number that repeats itself after an iteration.

But do any set of 3 randomly selected integers not all equal will lead to 495 after a finite number of iterations? First we see that for x,y and z,

z(100)+y(10)+x-(x(100)-y(10)-z)=(z-x)(99)

Hence the resulting number after any iteration is a 3-digit multiple of 99.

Hence we only need to check 9 possible numbers: 99,198,297,296,495,594,693,792 and 891 (10(99)=990 which is the same as 99)

Since all the above numbers lead to 495, QED.

Surprisingly, 495=5(99) which is in the middle of the pack of multiples of 99!

Can you see if you can generalise this result to 5 digit numbers and above?