A surprising result …
September 3, 2012 3 Comments

Gorgeous graph, isn’t it?
Deutsch, D. and Goldman, B. (2004)
Here’s a fun little math problem to start off your school year …
- Take any four digit number where all the digits are not the same.
- Next, rearrange the digits so as to create the largest and smallest numbers possible.
- Then subtract these numbers: largest – smallest.
- Continue to repeat the process with each new number until you get stuck (reach a fixed point). You’ll know when it happens!
Is the algorithm confusing? Let me start you off with an example. I will stop before the surprise!
- Take the number 4573 (Again, you don’t want a number where all the digits are the same, e.g. 5555)
- Rearrange the digits for the largest: 7543 and smallest: 3457
- Subtract: 7543 – 3457 = 4086
- Repeat the process with 4086: 8640 – 0468 = 8172 … 8721 – 1278 = 7443 … get the idea?
Some things to try:
- Pick a different number and try the algorithm again. Did the same thing happen? Beautiful, isn’t it!
- Once you realize what happens … which four digit number gets you to the fixed point in the fewest number of iterations?
- For all four digit numbers … is there a maximum number of iterations to get to the fixed point?
Still looking for some fun? Try these extensions:
- Try the same algorithm with any three digit number. What happens?
- How about any five digit number?
This algorithm is credited to the Indian mathematician D. R. Kaprekar and is known as Kaprekar’s Routine. (The fixed point, 6174, is sometimes called Kaprekar’s constant.) If you are as amazed as I am and want some additional information about the mathematics involved in the algorithm, then you can click on one of the links below:
About the graph … The figure above shows the number of steps required for the Kaprekar routine to reach a fixed point for values of n = 0 to 9999, partitioned into rows of length 100. Numbers having fewer than 4 digits are padded with leading 0s, thus resulting in all values converging to 6174. Image: Deutsch, D. and Goldman, B. (2004). Kaprekar’s Constant. Mathematics Teacher 98: 234-242. Click here for the link: Kaprekar’s Constant