Kaprekar’s constant

Kaprekar’s constant, named after Indian mathematician D.R. Kaprekar, is 6174. The significance of this number is the following:

  1. Take any four-digit number, except one that’s just the same digit four times. (A number with leading zeroes is fine.)
  2. Rearrange the digits from highest to lowest, then from lowest to highest, for two different numbers.
  3. Subtract the lower number from the higher number.
  4. Go back to step 2 and repeat.

If you do this over and over again, you will reach the number 6174 within seven iterations. After that, if you keep repeating the procedure, you’ll keep getting 7641 – 1467 = 6174. This process is called Kaprekar’s routine.

The equivalent constant for three-digit numbers is 495. Apparently, there is an equivalent constant for each set of n-digit numbers (e.g. one for five-digit numbers, one for six-digit numbers…). All of these constants are sometimes known in plural as “Kaprekar’s constants”.