# 1089 (, 495 and 6174) and all that

Take any 3 digit number where the first and last digit areat least 2 apart. (1st number)
Reverse it. (2nd number)
Minus the smaller number from the larger one. (3rdnumber)
Reverse it (4th number)
Add the 3rd and 4th number together.
This problem i first discovered in the book “1089 and all that”…an awesome little book!
Now, take any 3 digit number, with the only requirementbeing that all 3 numbers are not equal (so the number 001 is allowed)
Now, using these three digits, rearrange the numbers to makethe smallest and biggest possible numbers.
Now subtract the smaller number from the larger one.
Repeat this process. After a few steps you will reach 495.
Now do the same process for 4 digit numbers….you get 6174.
The great thing about these processes is they seem magicalto someone who has never heard of it before. Try the 1089 trick on a 10 yearold, you’ll convince them you’re magical!
These ‘tricks’ are – to me – some of the most interesting ‘tricks’around – well, when it comes to mathematics at least.  So what I thought I’d do in this post isexplore these numbers and why these methods work, and then see what othernumbers we can find etc.
So starting off with 1089:
Lets say your three numbers are x,y,z in that order. Lets alsosay that x is greater than z. so our two numbers are xyz and zyx. Subtracting thesegives:
(x-z) (y-y) (z-x)
Now, as z is less than x, we need to ‘borrow’ a 1 from they, so we actually have
(x-z)(y-1-y)(10+z-x)
But we also need to ‘borrow’ a 1 from the x
(x-1-z)(10+y-1-y)(10+z-x)
As we’re working mod 10, and if we let x-z =c, then we have
( c-1 ) (9) (10-(x-z))
Which is
( c -1) (9) (10-c)
Now we reverse this number
(10-c) (9) ( c-1)
+             ( c-1 )(9) (10-c)
=             ( 9)   (18) (9)
=             (9+1) (8) (9)
=             1089
This is always true.
Lets take the number x,y,z where x>y>z
Then we have
x    y      z
z     y      x
= (x-z)(y-y)(z-x)
Again, z<x so need to ‘borrow’ a 1 from the y, whichmeans we’ll need to borrow a 1 from the x. again, let x-z=c
(c-1)(9)(10-c)
If c were 1, we would have the number 990 and 099 for thenext round. If c were 0, it would mean that x=z and as x<y1
If c >5, then 10-c<c-1, so we will first look at when1<c<6
the biggest number will be
(9) (10-c)  (c-1)
And the smallest
(c-1) (10-c) (9)
Now, subtracting them gives
(9-c+1) (10-c-10+c) (c-1-9)
Again, we have to ‘borrow’ so
(9-c) (9) ( c )
With c being 2,3,4 or 5
If we did the same thing when c>5 , we would end up with( c ) , (9 ) , (11-c)
With c being, 6,7,8or 9.
If c is 2
We have 792, so
972-279=693, which is what we get if c is 3.
693 gives us
963-369=594, which is what get if c is 4…and  if c is 5, we get the number 495, which isthe magic number!
To confirm, 594 is 954-459=495.
If c is 6
We have 695 which is
965-569
396 which is the same as 693
If c is 7
We have 794 which is
974-479=495, which is the magic number
If c is 8
We have 893 which is
983-389=594 the magic number almost
If c is 9
We have 992 which is
Quickly looking at c=1
990-099=891 which is
This shows that it works for all numbers, unless all 3digits are the same.
A similar method can be used to show that for four digits,you get the number 6174, and this number is called the Kaprekar number.
What interests me is: what happens if you have n digits? Whathappens if you use repeated different operations (so using addition andsubtraction, but in different orders…maybe you subtract, subtract, add,subtract, subtract, add…)?
You could classify a sequence of operations as a binary operation.You could do operations on reversed numbers, or operations on biggest numberthat can be made from those digits and the smallest.
Any of these methods could yield some interesting observationsin number theory. Applications of these observations could be used in chaostheory or cryptography….but the point of doing number theory is that there areseldom applications!
In a way, these tricks remind me of collatz conjecture. EvenWikipedia thinks so, as the wiki page on 495 and 6174 both link through tocollatz. Interesting correlations.
I’ll end this post by looking at the Kaprekar routine fornumbers with 2 digits.
xy, with x>y
we have xy-yx=(x-y-1) (10-(x-y))
let x-y=c
we have (c-1) (c)
so we have (c) (c-1)-(c-1)(c)=(c-c+1-1)(c-1-c+10)=9
repeatedly subtracting the smallest possible number from thebiggest possible number from a set of digits for n digits:
digits     result
2              9
3              495
4              6174
5              ?