# Kaprekar’s constant

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

- Take any four-digit number, except one that’s just the same digit four times. (A number with leading zeroes is fine.)
- Rearrange the digits from highest to lowest, then from lowest to highest, for two different numbers.
- Subtract the lower number from the higher number.
- 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”.