Self referential numbers:

Take a number: 781
Order it's digits from largest to smallest:
871
reverse the order, and subtract that...
871 - 178 = 693
Repeat.
963 - 368 = 594
954 - 459 = 594

And so on. Obviously, numbers like 11, 333, and 7777 are excluded.

For two digit numbers, one always gets locked in the cycle:
09
90 - 09 = 81
81 - 18 = 63
63 - 36 = 27
72 - 27 = 45
54 - 45 = 09

It turns out that for all three and four digit numbers, one eventually arrives at the numbers 594 and 6174.

594
954 - 459 = 594

6174
7641 - 1467 = 6174

For five digit numbers, one gets locked in one of a number of different cycles.
There are 86,989 5-digit numbers that follow one or the other of these two patterns: There are 3,002 5-digit numbers that follow this pattern:
74943
97443 - 34479 = 62964
96642 - 24669 = 71973
97731 - 13779 = 83952
98532 - 23589 = 74943
63954
96543 - 34569 = 61974
97641 - 14679 = 82962
98622 - 22689 = 75933
97533 - 33579 = 63954
59994
99954 - 45999 = 53955
95553 - 35559 = 59994

Back to index