The Number That Describes Itself
The puzzle
Find a ten-digit number in which the first digit says how many 0s the number contains, the second how many 1s, the third how many 2s, and so on to the tenth, which says how many 9s.
There is exactly one.
Stuck?
One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.
Hint 1
The ten digits must add to 10, because together they count all ten positions.
Hint 2
Most of the digits must therefore be 0, which means the first digit is large.
Show the answer Hide the answer
6210001000.
How to get there
The digits count the ten positions between them, so they sum to 10. A sum of 10 across ten digits means most are 0, so the leading digit - the count of zeros - is large. Try 6.
With six 0s, four positions are non-zero. The 6 in position 0 means there is one 6, so position 6 holds 1. That 1, plus the 1 we just placed, means there are two 1s, so position 1 holds 2. That 2 is the only 2, so position 2 holds 1 - and that is the second 1 already accounted for.
The result is 6210001000. Check it: six 0s, two 1s, one 2, one 6, nothing else - and the digits are 6, 2, 1, 0, 0, 0, 1, 0, 0, 0, which sum to 10. It is the only ten-digit solution.
The technique worth keeping
Self-referential constraints are solved by finding an invariant the answer must satisfy - here that the digits sum to the length - and then propagating consequences until the configuration closes on itself.