What is Kaprekar's constant ?
6174 is known as Kaprekar's constant , a magical number in mathematics. The "magic" lies in a process discovered by the Indian mathematician Dattatreya Ramchandra Kaprekar in 1949. Here's how it works: The Kaprekar Routine: Take any four-digit number, using at least two different digits. (If the number has fewer than four digits, pad it with leading zeros to make it four digits). Arrange the digits in descending order and then in ascending order to get two four-digit numbers. Subtract the smaller number from the larger number. Repeat the process with the result. No matter what four-digit number you start with, after a few iterations, you'll always reach 6174 . Once you reach 6174, repeating the process will continue to yield 6174. This is why 6174 is often called a "self-repeating number" or Kaprekar's constant. Example: Start with 3524: Descending: 5432 Ascending: 2345 Subtract: 5432 - 2345 = 3087 Now repeat the process: Descending: 8730 Ascending