What Number Comes Next? Ask the Encyclopedia of Integer Sequences.

Some numbers are odd:

1, 3, 5, 7, 9, 11, 13, 15 …

Some are even:

2, 4, 6, 8, 10, 12, 14, 16 …

And then there are the puzzling “eban” numbers:

2, 4, 6, 30, 32, 34, 36, 40 …

What number comes next? And why?

These are questions that Neil Sloane, a mathematician of Highland Park, N.J., loves to ask. Dr. Sloane is the founder of the On-Line Encyclopedia of Integer Sequences, a database of 362,765 (and counting) number sequences defined by a precise rule or property. Such as the prime numbers:

2, 3, 5, 7, 11, 13, 17, 19 …

Or the Fibonacci numbers — every term (starting with the 3rd term) is the sum of the two preceding numbers:

0, 1, 1, 2, 3, 5, 8, 13 …

This year the OEIS, which has been praised as “the master index to mathematics” and “a mathematical equivalent to the FBI’s voluminous fingerprint files,” celebrates its 50th anniversary. The original collection, “A Handbook of Integer Sequences,” appeared in 1973 and contained 2,372 entries. In 1995, it became an “encyclopedia,” with 5,487 sequences and an additional author, Simon Plouffe, a mathematician in Quebec. A year later, the collection had doubled in size again, so Dr. Sloane put it on the internet.

“In a sense, every sequence is a puzzle,” Dr. Sloane said in a recent interview. He added that the puzzle aspect is incidental to the database’s main purpose: to organize all mathematical knowledge.

Sequences found in the wild — in mathematics, but also quantum physics, genetics, communications, astronomy and elsewhere — can be puzzling for numerous reasons. Looking up these entities in the OEIS, or adding them to the database, sometimes leads to enlightenment and discovery.

“It’s a source of unexpected results,” said Lara Pudwell, a mathematician at Valparaiso University in Indiana and a member of the OEIS Foundation’s board of trustees. Dr. Pudwell writes algorithms to solve counting problems. A few years ago, thus engaged, she entered into the OEIS search box a sequence that arose while studying numerical patterns:

2, 4, 12, 20, 38, 56, 88 …

The only result that popped up pertained to chemistry: specifically, to the periodic table and the atomic numbers of the alkaline earth metals. “I found this perplexing,” Dr. Pudwell said. She consulted with chemists and soon “realized there were interesting chemical structures to work with to explain the connection.”

Sequence serendipity provides what Russ Cox, a software engineer at Google, called “amazing cross-connective tissue for the sciences.” Dr. Cox, based in Cambridge, Mass., is the president of the OEIS board. He submitted his first sequence, which emerged from a programming contest puzzle, as a high-school student in 1996. He has twice rewritten the software for the database, which he thinks of as “the collective wisdom of math and science in this interesting numerical form.”

Donald Knuth, a computer scientist at Stanford, known for his analysis of algorithms, among other things, has also chanced upon breakthroughs. Working on a new problem, he always searches the OEIS. “It finds my bedfellows,” he said. “The beautiful thing is that you can compute your way into the literature.”

What number comes next?Credit…Tony Cenicola/The New York Times

A numerical punchline

Searching the database for “puzzle” produces more than 1,700 results. Some entries describe physical puzzles, such as the Rubik’s cube and its “God’s Number,” the maximum number of turns needed to solve a scrambled cube: 11 for a 2 × 2 × 2 cube, 20 for the classic 3 × 3 × 3 cube. Beyond that — say, for the 4 × 4 × 4 Rubik’s Revenge — God’s Number is uncertain, making for a short sequence thus far: 0, 11, 20.

“We have bounds on God’s number for 4 × 4 × 4, but they’re very loose,” Erik Demaine, a computer scientist at the Massachusetts Institute of Technology, said in an email. “We know it’s between 31 and 16,777,214.”

The OEIS is long on sequences that tease and land like a joke — like the eban sequence, invented by Dr. Sloane. “It’s very, very simple,” he said. “And yet nobody ever guesses it.”

More terms are not necessarily helpful: 2, 4, 6, 30, 32, 34, 36, 40, 42, 44, 46, 50, 52, 54, 56, 60, 62, 64, 66, 2000, 2002, 2004, 2006, 2030 …

The punchline of the eban numbers is that the letter “e” is banned: This sequence contains no numbers that, when the numbers are spelled out, contain the letter “e.”

“Eban sounds a bit like ‘even,’ and it’s a very nice pun,” Dr. Sloane said — because if you look at numbers without an “e,” they are all even. “This is an old theorem of mine: that every odd number has an ‘e’ in it, in English. And so all the numbers where ‘e’ is banned are even. Of course, not all even numbers are eban, but enough are to make a good sequence.”

What’s the next number?

Here are a few more sequences to try (answers below):

1) 0, 1, 8, 11, 69, 88, 96, 101 …

2) 1, 11, 21, 1211, 111221, 312211 …

3) 5, 8, 12, 18, 24, 30, 36, 42 …

4) 14, 18, 23, 28, 34, 42, 50 …

Dr. Sloane first went looking for a sequence in 1964, as a graduate student. Studying paths in an artificial neural network (a mathematical system mimicking the human brain), his computations generated:

0, 1, 8, 78, 944, 13800 …

“I badly needed a formula for the nth term in order to determine the rate of growth of the terms,” he wrote in a retrospective published in April. “This would indicate how long the activity in this very simple neural network would persist.” Hunting through textbooks, reference books, journals, he came close, but no sequence. Eventually, together with the combinatorialist John Riordan, he figured out the formula, and the next term: 237432.

Along the way, Dr. Sloane recorded sequences on file cards, then on punched cards. “These were never called ‘punch cards’,” he wrote. “To anyone who worked with them in the 1960s, ‘punch cards’ sounds like ‘grill cheese’ for ‘grilled cheese.’”

Once online in 1995, it dominated his home page on the website of AT&T Labs, where he worked for 43 years. In 2010, it became a moderated wiki and now is run by about 170 international volunteer editors who wrangle 50 or more new submissions a day. The OEIS Foundation recently announced an endowment campaign to fund a full-time managing editor.

Dr. Sloane’s signature lecture on the subject is titled “Confessions of a Sequence Addict.” And he showcases his favorite sequences on Numberphile, an educational math YouTube channel, ever asking “What number comes next?” with the likes of this procession:

1, 4, 8, 48, 88, 488 …

The best way to puzzle it out is to “stare at these numbers,” he advised. “Look at the number 8. What do you see?”

“Well, you see ‘8,’ but more important you see two holes,” he said. “When you look at 48, you see three holes; 88 has four holes in it; 4 has one hole.”

“And 1 has no holes in it. So, the definition of this sequence is: The smallest positive number that has ‘n’ holes in it.” (That is, assuming an enclosed “4” and a “2” with no closed loop.)

What number comes next?Credit…Tony Cenicola/The New York Times

A Sisyphean task

Among Dr. Sloane’s current favorites is the Sisyphus sequence, devised in 2022 by Éric Angelini, a journalist and amateur mathematician in Brussels, and his sometime accomplice, Carole Dubois, of Toulouse, France.

1, 3, 6, 3, 8, 4, 2, 1, …

The Sisyphus rule: If the number is even, divide by two. If the number is odd, add the smallest prime number not yet added. The first term, 1, is odd, so adding the smallest prime number, 2, gives 3; 3 is odd, so adding the next prime, 3, gives 6; 6 is even, so dividing by two gives 3, and so on.

“Now here’s the interesting question,” said Dr. Sloane: Some numbers appear more than once, but does every number appear at least once? “We don’t know.”

The number 36 was stubborn — it was still absent after the sequence had been computed to a billion terms. This was “really worrying,” Dr. Sloane said. “It would be like a floor in the universe, if 36 was missing.”

At the end of an OEIS board meeting last year, Dr. Sloane, the chairman, asked if there was any further business, and since there wasn’t, he explained how Sisyphus was stuck. He asked the assembled experts, “Does 36 ever appear in this beautiful sequence?” Two hours later, Dr. Cox found it at the far reaches of 77 billion terms — the 7,7534,485,877th term lands on 36.

While still pondering Sisyphus, Dr. Sloane is also — always — keeping tabs on any number of consequential developments and discoveries. Mr. Angelini called him a “puzzle chaser.” Dr. Sloane admitted to being a “sequence chaser.” And when not in hot pursuit, he is working on his book, “The Joy of Seqs.”


1) 111. These are the “strobogrammatic” numbers — the same upside-down, or rotated 180 degrees (not flipped along the horizontal axis).

2) 13112221. This is the “Look and Say” sequence: At the first term, 1, you describe what you see — one 1 — so the next term is 11. At the second term (11) you again describe what you see — two 1s — so the next term is 21. Describing that — one 2 and one 1 — results in the next term, 1211, and so on.

3) 52. The sums of two consecutive primes.

4) 59. The numbered stops on the 1 train in Manhattan.

Back to top button