Well, 6147 was dubbed Kaprekar’s Constant in 1949 and it has a unique property in relation to nearly any other 4-digit number. This property is known as Kaperekar’s Routine.
Suppose you have a 4-digit number (with at least 2 different digits) you can perform Kaprekar’s routine.
Choosing 7238 as our test subject, I guarantee you within 7 iterations of special subtraction we will end up with 6147.
First, we take 7238 and rearrange to make the largest 4-digit number possible.
Now we subtract the opposite of this number — 2378 from 8732.
8732–2378 = 6354
Now repeat the step again so we get 6543 (largest number from the difference)
Reverse the order to get — 3456 and let’s do our subtraction again.
6543–3456 = 3087
By now you should understand the steps. So I will fast forward and start calculating.
8730–378 = 8352
8532–2358 = 6147
And Bingo, in less than 7 iterations we got our magic number 6147.
If you are more interested in understanding why Kaprekar’s Routine occurs check out this pdf link: I’m a pdf link