Self-describing number
From Carls wiki
The ten-digit number 6210001000 is self-describing because it makes a full inventory of the number of digits of each kind it contains: the 6 in the beginning corresponds to its six zeros, the 2 corresponds to its two ones, and so on. Generally, an n-digit number is self-describing if at each (zero-based) position k, we find a number corresponding the number of occurrences of the figure k in the number. Note that the digit sum of a self-describing number must always equal its length, since all digits must be accounted for. Specifically, in the case above, 6 + 2 + 1 + 1 = 10.
Are there any other self-describing ten-digit numbers? No, only a pair of mutually describing ones: 7101001000 and 6300000100 each describe the number of digits of each kind in the other number. (Note, for example, that the 7 in the first number corresponds to the seven digits in the second.) Apart from these three special numbers, there appear to be no closed loops among the ten-digit numbers.
Generalizing to n-digit numbers, we find a couple of things. There are no self-describing 1-digit numbers, for example. Likewise, there are no self-describing 2-digit or 3-digit numbers. It's like these spaces are too small to contain any loops. But then it gets interesting.
- Among the 4-digit numbers, 1210 and 2020 are self-describing.
- 21200 is the only 5-digit self-describing number.
- There is no self-describing 6-digit number, but a pair of mutually describing ones: 311100 and 230100.
- The 7-digit numbers both have a self-describing number 3211000, and our first mutual-description loop with three numbers in it: 3300100, 4102000 and 4110100.
- There is one self-describing 8-digit number 42101000, and the mutually describing numbers 43000100, 51011000.
- 9-digit numbers also have one self-describing number 521001000, and a loop 530000100, 610101000.
As soon as we go above 10, the question of number base is raised. A natural extension would probably be that for for n-digit numbers, the base is always at least n; this way we avoid overflow problems where there are more digits of one type in a number than there are digits in the base.
