[HN Gopher] Kaprekar's Magic 6174
       ___________________________________________________________________
        
       Kaprekar's Magic 6174
        
       Author : olooney
       Score  : 33 points
       Date   : 2024-06-14 13:01 UTC (10 hours ago)
        
 (HTM) web link (www.oranlooney.com)
 (TXT) w3m dump (www.oranlooney.com)
        
       | ur-whale wrote:
       | No attempts at generalization to larger numbers of digits?
        
         | dmichulke wrote:
         | From https://en.wikipedia.org/wiki/D._R._Kaprekar
         | 
         | A similar constant for 3 digits is 495.[7] However, in base 10
         | a single such constant only exists for numbers of 3 or 4
         | digits; for other digit lengths or bases other than 10, the
         | Kaprekar's routine algorithm described above may in general
         | terminate in multiple different constants or repeated cycles,
         | depending on the starting value
        
       | hiperlink wrote:
       | Previous discussion:
       | https://news.ycombinator.com/item?id=39018769
        
       | dash2 wrote:
       | Sort the digits to 'wxyz', where each letter is a 0-9 digit.
       | 
       | 'wxyz' - 'zyxw' = 999(w - z) + 90(x - y)
       | 
       | w - z is between 1 and 9, since w > z (we have ruled out numbers
       | like 1111). x - y is between 0 and 9. So there are at most 90
       | such numbers. In fact there are fewer because x-y <= w-z.
       | 
       | This is why there are many collisions in the first step.
        
       | dimastopel wrote:
       | Numberphile video on the topic:
       | https://youtu.be/d8TRcZklX_Q?si=t9x2HLWYOpPiTbn4
        
       | pierrebai wrote:
       | Interestingly, there is a common pattern for fixed-points and
       | cycles for different number lengths: numbers made of 4, 5 and 9.
       | For example
       | 
       | length 3: fixed-point 495 length 5: 2-cycle containing 59994
       | length 6: fixed-point 59994
       | 
       | Similarly for digits 6, 1, 4, 7:
       | 
       | length 4: 6174 length 5: 4-cycle containing 61974 length 6:
       | fixed-point 631764
        
       ___________________________________________________________________
       (page generated 2024-06-14 23:02 UTC)