Kaprekar Constant - GeeksforGeeks
6174 is the Kaprekar Constant. This number is special as we always get this number when following steps are followed for any four digit number such that all digits of number are not same, i.e., all four digit numbers excluding (0000, 1111, …)
- Sort four digits in ascending order and store result in a number "asc".
- Sort four digits in descending order and store result in a number "desc".
- Subtract number larger number from smaller number, i.e., abs(asc – desc).
- Repeat above three steps until the result of subtraction doesn't become equal to the previous number.
We always end up with 6174.
Read full article from Kaprekar Constant - GeeksforGeeks
No comments:
Post a Comment