Sam Gentle.com

I got 99 solutions

A few days ago on Reddit, I saw someone post this observation: "The number 14233221 describes itself; it has one four, two threes, three twos, and two ones." I thought that was pretty interesting, so I thought I'd take a closer look. The numbers are very similar to the look-and-say sequence as studied to death by John Conway of Game of Life fame.

In the traditional look-and-say sequence you say 1, 11, 21, 1211, 111221, or "one", "one one", "one two, one one", and so on. However, we want to count the digits instead of reading them in order, so: 11, 21, 1112, 3112, [...], 21322314. This last number is actually the same as our original 14233221 with the digits in a different order. These have been described as descriptive numbers and counting sequences. What we want are the fixed points of this descriptive/counting function.

Another closely related idea is the autobiographical or self-descriptive number. These are numbers such as 1210 where the first digit represents the number of 0s, the next the number of 1s and so on. The largest of these is 6210001000. In fact, there are only 7 of them assuming you only allow digits up to 9. However, there are many more of the kinds of numbers we're looking for.

To find out just how many, I put together a program to search through them. Initially I wanted to be clever and search in some incremental way through the space of numbers by just picking some seed numbers and generating new numbers until I found the fixed points. Unfortunately, I couldn't figure out how to be sure that I'd get all the numbers. Maybe someone with more substantial mathematical chops than me would be able to figure it out, but I had to settle for a brute force approach.

However, I found an interesting shortcut: while you can have a solution that starts with 10 (like 10213223), you can't have one that starts with 20, or indeed any number of 0s other than 1. This eliminates 80% of the candidate solutions fairly quickly. I maybe could have found other clever things, but by that point my program was fast enough anyway, so I just ran it. It turns out the smallest of these numbers is 22, and there is only one solution that uses every digit. I'll put the full list in a box below, but it might be a fun exercise to find the largest one yourself.

One curious fact: there are, in fact, 99 solutions. Since there does not appear to already be a satisfying name for these, how do we feel about Beyoncé numbers?