Kaprekar's Iterations and Constants

In 1955, D. Kaprekar published a surprising result, concerning what is now known as Kaprekar's process. The process is iterative, such that the same procedure applies to the numbers obtained at each step. The surprise is what this process leads to. So, start with any 4-digit number. Then

  1. Arrange the digits of the number in the increasing and also in the decreasing order.

  2. Of the two numbers thus obtained, one is larger, the other smaller. Subtract the latter from the former.

  3. If the result is the same as the number in 1., stop. Otherwise, repeat 1-2 for the new number.

Two view points emerged since Kaprekar's publication. According to one, whenever the difference on step 2 has fewer than 4 digits, it is padded with zeros on the left to force a fixed number of digits on any step. The other approach is to let the intermediate numbers maintain their natural number of digits.

If all digits of the starting number are equal the very first step of the iterations produces 0. Excluding this case, the two approaches may lead to different results. Kaprekar's observation was that the first approach (the one with the fixed number of digits) always leads to the number 6174, which is a fixed point of the Kaprekar's process. Unless the numbers are padded when necessary, the process may occasionally lead to 0. This happens when all digits are equal, except for one, which is 1 larger or smaller than the rest, e.g., 1121 or 3444. Since, say,

2111 - 1112 = 999,

the very next step gives 0. To compare, if the number of digits is fixed, the above continues as

9990 - 999 = 8991,
9981 - 1899 = 8082,
8820 - 288 = 8532,
8532 - 2358 = 6174.

If you are reading this, your browser is not set to run Java applets. Try IE11 or Safari and declare the site https://www.cut-the-knot.org as trusted in the Java setup.

Kaprekar's Iterations and Constants

What if applet does not run?

(Blue and thick black numbers are clickable.)

Nowadays number 6174 is known as Kaprekar's number or Kaprekar's constant.

The applet allows you to experiment with bases other than decimal and number of digits other than 4.

|Contact| |Front page| |Contents| |Algebra|

Copyright © 1996-2018 Alexander Bogomolny