What is your favorite number? For many people, it may be an irrational number such as pi (π), Euler's number (e) or the square root of 2. Even among the natural numbers (positive integers), there are values that feel significant because we encounter them in a wide variety of contexts: the seven dwarfs, the seven deadly sins, the unlucky number 13—and 42, which was popularized by the 1979 novel The Hitchhiker's Guide to the Galaxy, written by Douglas Adams.

What about a larger value such as 1,729? The number certainly doesn't seem particularly exciting. It's not a prime number or a power of 2 or the square of some other number. The digits don't seem to follow any obvious pattern. That's what mathematician Godfrey Harold Hardy thought when, in 1918, he got into a cab in London with the identification number 1729. At the time, he was on his way to visit his ailing colleague Srinivasa Ramanujan in the hospital, and he mentioned the “boring” cab number when he arrived. He told Ramanujan he hoped it wasn't a bad omen. Ramanujan immediately contradicted his friend: “It is a very interesting number; it is the smallest number expressible as a sum of two cubes in two different ways.”

You may wonder: Is there any number that is not interesting in some way? The question quickly leads to a paradox: if there is a value n that has no exciting properties, this very fact makes it special. But there is a way to determine the interesting properties of a number fairly objectively—and to mathematicians' great surprise, research in 2009 suggested that natural numbers can be divided into two sharply defined camps: exciting values and boring ones.

A comprehensive encyclopedia of number sequences provides a means for investigating these two opposing categories. Mathematician Neil Sloane had the idea for such a compilation in the 1960s, when he was writing his doctoral thesis. He had to calculate the height of values in a type of graph called a tree network and came across a sequence of numbers: 0, 1, 8, 78, 944 ... He didn't know how to calculate the numbers in this sequence exactly, and he wanted to know whether his colleagues had already come across a similar sequence. But unlike for logarithms or formulas, there was no registry for sequences of numbers. And so, 10 years later, Sloane published his first encyclopedia, A Handbook of Integer Sequences, which contained about 2,400 sequences that also proved useful in making certain calculations. The book was met with enormous approval. “There's the Old Testament, the New Testament and the Handbook of Integer Sequences,” wrote one enthusiastic reader, according to Sloane.

In the years that followed, Sloane's catalog of number sequences got bigger. In 1995 the mathematician, together with his colleague Simon Plouffe, published The Encyclopedia of Integer Sequences, which contained some 5,500 entries. The list has been growing ever since. As of March 2023, the Online Encyclopedia of Integer Sequences (OEIS) contained more than 360,000 items. Anyone can make a submission—they just have to say how the sequence was generated and why it's interesting, and provide examples explaining the first few terms. Reviewers then check the entry, and if it meets their criteria, it gets published.

Besides well-known sequences such as the prime numbers (2, 3, 5, 7, 11 ...), the powers of 2 (2, 4, 8, 16, 32 ...) and the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13 ...), the OEIS catalog contains exotic entries such as the number of ways to build a stable tower from n two-by-four-studded LEGO blocks (1, 24, 1,560, 119,580, 10,166,403 ...) and the “lazy caterer's sequence” (1, 2, 4, 7, 11, 16, 22, 29 ...), which is the maximum number of pieces you can slice a pie into with n cuts. The collection is intended to be an objective compilation of all sequences, which makes it useful for studying the popularity of numbers—the more often a number appears in the list, the more interesting it is.

At least that was the logic of Philippe Guglielmetti, who runs the French-language science blog Dr. Goulu. In one post, Guglielmetti recalls a math teacher's claim that 1,548 is an arbitrary number with no special properties. In fact, this number appears 326 times in the OEIS catalog. One example: it shows up as an “eventual period of a single cell in rule 110 cellular automaton in a cyclic universe of width n.” Hardy was also wrong when he said the cab number 1729 was boring: 1,729 appears 918 times in the database (and also frequently in episodes of the television show Futurama).

Guglielmetti went in search of really boring numbers: those that appear in the OEIS catalog only very rarely or, like 20,067, not at all. As of this past March, 20,067 was the smallest number that did not appear in any of the OEIS's stored number sequences. (This is because the database stores only the first 180 or so characters of a number sequence, however; otherwise every number would appear in the OEIS's list of positive integers.) There are just six entries for 20,068.

Graph plots how many times interesting and uninteresting numbers from 0 to 10,000 appear in the Online Encyclopedia of Integer Sequences.
Credit: Philippe Guglielmetti (graphic), restyled by Jen Christiansen

Guglielmetti went on to plot the sequence of boring numbers graphically. He found a cloud of points in the form of a broad curve that slopes toward large values. This is not surprising insofar as only the first members of a sequence are stored in the OEIS catalog. What is surprising, however, is that the curve consists of two bands that are separated by a clearly visible gap. The gap means that any given natural number appears either particularly frequently or extremely rarely in the OEIS database.

Fascinated by this result, Guglielmetti turned to mathematician Jean-Paul Delahaye of the University of Lille in France, who regularly writes for Pour la Science, Scientific American's French-language partner publication. He wanted to know whether experts had already studied this phenomenon. They had not, so Delahaye took up the topic with his colleagues Nicolas Gauvrit, also at Lille, and Hector Zenil of the University of Cambridge. They used results from algorithmic information theory, which measures the complexity of an expression by the length of the shortest algorithm that describes the expression. For example, an arbitrary five-digit number such as 47,934 is more difficult to describe (“the sequence of digits 4, 7, 9, 3, 4”) than 16,384 (214). According to a theorem from information theory, numbers with many properties usually also have low complexity. That is, the values that appear frequently in the OEIS catalog are the most likely to be simple to describe. Delahaye, Gauvrit and Zenil were able to show that information theory predicts a trajectory for the complexity of natural numbers that is similar to the one shown in Guglielmetti's curve. But this does not explain the gaping hole in that curve, known as Sloane's gap, after Neil Sloane.

The three mathematicians suggested that the gap arises from social factors such as preferences for certain numbers. To substantiate this, they ran what is known as a Monte Carlo simulation: they designed a function that maps natural numbers to other natural numbers—and does so in such a way that small numbers are output more often than larger ones. The researchers put random values into the function and plotted the results according to their frequency. The end product was a fuzzy, sloping curve similar to that of the data in the OEIS catalog. And just as with the information theory analysis, there was no trace of a gap.

To better understand why the gap occurs, one must look at which numbers fall into which band. For values up to about 300, Sloane's gap is not very pronounced. Only for larger numbers does the gap open up significantly: about 18 percent of all numbers between 300 and 10,000 are in the “interesting” band, and the remaining 82 percent are “boring” values. As it turns out, the interesting band includes about 95.2 percent of all square numbers and 99.7 percent of prime numbers, as well as 39 percent of numbers with many prime factors. These three classes account for nearly 88 percent of the interesting band. The remainder consists of values with striking properties, such as 1,111 or the formulas 2n + 1 and 2n– 1.

According to information theory, the numbers that should be of particular interest are those that have low complexity, meaning they are easy to express. But if mathematicians consider certain values more exciting than others of equal complexity, this can lead to Sloane's gap, as Delahaye, Gauvrit and Zenil argue. For example: 2n + 1 and 2n + 2 are equally complex from an information theory point of view, but only values of the first formula are in the interesting band. Those values appear in many different contexts because they allow prime numbers to be studied.

The split into interesting and boring numbers, then, seems to result from judgments we make, such as attaching importance to prime numbers. If you want to give a really creative answer when asked what your favorite number is, you could always say, “20,067.”