Kaprekar … one more time!

Following up on my previous post titled “A surprising result …” involving Kaprekar’s Operation, I thought I would offer one more interesting result from the Indian mathematician D. R. Kaprekar.  So let’s talk about a Kaprekar Number.

What’s a Kaprekar number?  Take an n-digit number k. Square it and add the right n digits to the left n or n-1 digits. If the resultant sum is k, then k is called a Kaprekar number.  Oh, is that all?  I thought it was going to be something complicated to understand!

Let me show you by example.

  • Take the number 45.  This means that k = 45.  Since it is a 2 digit number we have n = 2.
  • Square it.  Now we have 2025.  The right 2 digits are 25 and the left 2 digits are 20.  (Remember n = 2.)
  • If you look at the sum of 20 and 25 you get 45.
  • So we call 45 a Kaprekar number.

Let’s try a second example.

  • Take the number 297.  This means that  k = 297.  Since it is a 3 digit number we have n = 3.
  • Square it.  Now we have 88209.  The right 3 digits are 209 and left 2 digits (remember n or n-1) are 88.
  • If you look at the sum of 209 and 88 you get 297.
  • So we call 297 a Kaprekar number.

Amazing, isn’t it?  Can you think of any other Kaprekar Numbers?  There are plenty of them out there in the great mathematical universe.

If you are interested in reading more about the theory behind Kaprekar Numbers, you can look at the paper titled “The Kaprekar Numbers” by Douglas E. Iannucci published in the Journal of Integer Sequences.

(Thanks to MathWorld for the official definition of a Kaprekar Number:  Weisstein, Eric W. “Kaprekar Number.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/KaprekarNumber.html)

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