:date: 2024-05-30 12:34 .. Tags for the index .. index:: 6174 .. .. seealso:: :ref: .. Reference for linking into the menues. .. _2024-6174: 6174 ==== The number `6174`_, or Kaprekar's, constant is interesting. It will automatically show up when you do the following: 1. Take a four digit number with at least two different digits (allowing leading zeros). 2. Arrange the digits descending and ascending to two four digit numbers. Add leading zeros is required. 3. Subtract the smaller number from the bigger number. 4. Repeat from the second step. If you do this a repeated number of times, you will come to 6174 in at most 7 iterations. From 6174 there is no way out. Let's e.g. take 8664. .. code:: bash 8664 - 4668 = 3996 9963 - 3699 = 6264 6642 - 2466 = 4176 7641 - 1467 = 6174 7641 - 1467 = 6174 .. _`6174`: https://en.m.wikipedia.org/wiki/6174