A surprising result …

Gorgeous graph, isn’t it?
Deutsch, D. and Goldman, B. (2004)

Here’s a fun little math problem to start off your school year …

  1. Take any four digit number where all the digits are not the same.
  2. Next, rearrange the digits so as to create the largest and smallest numbers possible.
  3. Then subtract these numbers:  largest – smallest.
  4. 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!

  1. Take the number 4573 (Again, you don’t want a number where all the digits are the same, e.g. 5555)
  2. Rearrange the digits for the largest:  7543 and smallest:  3457
  3. Subtract:  7543 – 3457 = 4086
  4. Repeat the process with 4086:  8640 – 0468 = 8172 … 8721 – 1278 = 7443 … get the idea?

Some things to try:

  1. Pick a different number and try the algorithm again.  Did the same thing happen?  Beautiful, isn’t it!
  2. Once you realize what happens … which four digit number gets you to the fixed point in the fewest number of iterations?
  3. 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:

  1. Try the same algorithm with any three digit number.  What happens?
  2. 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

3 Responses to A surprising result …

  1. Pingback: Kaprekar … one more time! « Musings on Math

  2. Pingback: The Week in Math: January 14 – January 20 « Musings on Math

  3. Pingback: The Week in Math: January 13 – January 19 | Musings on Math

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: