For Math Fans: A Hitchhiker’s Guide to the Number 42

Here is how a perfectly ordinary number captured 
the interest of sci-fi enthusiasts, geeks and mathematicians
    * By 
Delahaye on September 21, 2020
For Math Fans: A Hitchhiker's Guide to the Number 42

na Hemsley 

Everyone loves unsolved mysteries. Examples 
include Amelia Earhart’s disappearance over the 
Pacific in 1937 and the daring escape of inmates 
Frank Morris and John and Clarence Anglin from 
Alcatraz Island in California in 1962. Moreover 
our interest holds even if the mystery is based 
on a joke. Take author Douglas Adams’s popular 
1979 science-fiction novel The Hitchhiker’s Guide 
to the Galaxy, the first in a series of five. 
Toward the end of the book, the supercomputer 
Deep Thought reveals that the answer to the 
“Great Question” of “Life, the Universe and Everything” is “forty-two.”

Deep Thought takes 7.5 million years to calculate 
the answer to the ultimate question. The 
characters tasked with getting that answer are 
disappointed because it is not very useful. Yet, 
as the computer points out, the question itself 
was vaguely formulated. To find the correct 
statement of the query whose answer is 42, the 
computer will have to build a new version of 
itself. That, too, will take time. The new 
version of the computer is Earth. To find out 
what happens next, you’ll have to read Adams’s books.

The author’s choice of the number 42 has become a 
fixture of geek culture. It’s at the origin of a 
multitude of jokes and winks exchanged between 
initiates. If, for example, you ask your search 
engine variations of the question “What is the 
answer to everything?” it will most likely answer 
“42.” Try it in French or German. You’ll often 
get the same answer whether you use Google, 
Qwant, Wolfram Alpha (which specializes in 
calculating mathematical problems) or the chat bot Web app Cleverbot.

Since the first such school was created in France 
in 2013 there has been a proliferation of private 
computer-training institutions in the “42 
Network,” whose name is a clear allusion to 
Adams’s novels. Today the founding company counts 
more than 15 campuses in its global network. The 
number 42 also appears in different forms in the 
film Spider-Man: Into the Spider-Verse. Many 
and allusions to it can be found, for example, in 
the Wikipedia entry for “42 (number).”

The number 42 also turns up in a whole string of 
curious coincidences whose significance is 
probably not worth the effort to figure out. For example:

In ancient Egyptian mythology, during the 
judgment of souls, the dead had to declare 
42 judges that they had not committed any of 42 sins.

The marathon distance of 42.195 kilometers 
corresponds to the legend of how far the ancient 
Greek messenger Pheidippides traveled between 
Marathon and Athens to announce victory over the 
Persians in 490 B.C. (The fact that the kilometer 
had not yet been defined at that time only makes 
the connection all the more astonishing.)

Ancient Tibet had 
rulers. Nyatri Tsenpo, who reigned around 127 
B.C., was the first. And Langdarma, who ruled 
from 836 to 842 A.D. (i.e., the 42nd year of the ninth century), was the last.

The Gutenberg Bible, the first book printed in 
Europe, has 42 lines of text per column and is 
also called the “Forty-Two-Line Bible.”

According to a March 6 Economist blog post 
marking the 42nd anniversary of the radio program 
The Hitchhiker’s Guide to the Galaxy, which 
preceded the novel, 
42nd anniversary of anything is rarely observed.”

A Purely Arbitrary Choice

An obvious question, which indeed has been asked, 
is whether the use of 42 in Adams’s books had any 
particular meaning for the author. His answer, 
posted in the online discussion group, was succinct: “It was a 
joke. It had to be a number, an ordinary, 
smallish number, and I chose that one. Binary 
representations, base thirteen, Tibetan monks are 
all complete nonsense. I sat at my desk, stared 
into the garden and thought ‘42 will do.’ I typed it out. End of story.”

In the binary system, or base 2, 42 is written as 
101010, which is pretty simple and, incidentally, 
prompted a few fans to hold parties on October 
10, 2010 (10/10/10). The reference to base 13 in 
Adams’s answer requires a more indirect 
explanation. In one instance, the series suggests 
that 42 is the answer to the question “What do 
you get if you multiply six by nine?” That idea 
seems absurd because 6 x 9 = 54. But in base 13, 
the number expressed as “42” is equal to (4 x 13) + 2 = 54.

Apart from allusions to 42 deliberately 
introduced by computer scientists for fun and the 
inevitable encounters with it that crop up when 
you poke around a bit in history or the world, 
you might still wonder whether there is anything 
special about the number from a strictly mathematical point of view.

Mathematically Unique?

The number 42 has a range of interesting 
mathematical properties. Here are some of them:
The number is the sum of the first three odd 
powers of two­that is, 21 + 23 + 25 = 42. It is 
an element in the sequence a(n), which is the sum 
of n odd powers of 2 for n > 0. The sequence 
corresponds to entry 
<>A020988 in 
<>The On-Line Encyclopedia of 
Integer Sequences (OEIS), created by 
mathematician Neil Sloane. In base 2, the nth 
element may be specified by repeating 10 n times 
(1010 ... 10). The formula for this sequence is 
a(n) = (2/3)(4n – 1). As n increases, the density 
of numbers tends toward zero, which means that 
the numbers belonging to this list, including 42, are exceptionally rare.

The number 42 is the sum of the first two nonzero 
integer powers of six­that is, 61 + 62 = 42. The 
sequence b(n), which is the sum of the powers of 
six, corresponds to entry 
<>A105281 in OEIS. It is 
defined by the formulas b(0) = 0, b(n) = 6b(n – 
1) + 6. The density of these numbers also tends toward zero at infinity.

Forty-two is a Catalan number. These numbers are 
extremely rare, much more so than prime numbers: 
only 14 of the former are lower than one billion. 
Catalan numbers were first mentioned, under 
another name, by Swiss mathematician Leonhard 
Euler, who wanted to know how many different ways 
an n-sided convex polygon could be cut into 
triangles by connecting vertices with line 
segments. The beginning of the sequence 
(<>A000108 in OEIS) is 1, 
1, 2, 5, 14, 42, 132.... The nth element of the 
sequence is given by the formula c(n) = (2n)! / 
(n!(n + 1)!). And like the two preceding 
sequences, the density of numbers is null at infinity.

Catalan numbers are named after Franco-Belgian 
mathematician Eugène Charles Catalan (1814–1894), 
who discovered that c(n) is the number of ways to 
arrange n pairs of parentheses according to the 
usual rules for writing them: a parenthesis is 
never closed before it has been opened, and one 
can only close it when all the parentheses that 
were subsequently opened are themselves closed.

For example, c(3) = 5 because the possible 
arrangements of three pairs of parentheses are:

( ( ( ) ) ); ( ) ( ) ( ); ( ( ) ) ( ); ( ( ) ( ) ); ( ) ( ( ) )

Forty-two is also a “practical” number, which 
means that any integer between 1 and 42 is the 
sum of a subset of its distinct divisors. The 
first practical numbers are 1, 2, 4, 6, 8, 12, 
16, 18, 20, 24, 28, 30, 32, 36, 40, 42, 48, 54, 
56, 60, 64, 66 and 72 (sequence 
<>A005153 in OEIS). No 
simple known formula provides the nth element of this sequence.

All this is amusing, but it would be wrong to say 
that 42 is really anything special 
mathematically. The numbers 41 and 43, for 
example, are also elements of many sequences. You 
the properties of various numbers on Wikipedia.

What makes a number particularly interesting or 
uninteresting is a question that mathematician 
and psychologist Nicolas Gauvrit, computational 
natural scientist Hector Zenil and I have 
studied, starting with an analysis of the 
sequences in the OEIS. Aside from a theoretical 
connection to Kolmogorov complexity (which 
defines the complexity of a number by the length 
of its minimal description), we have shown that 
the numbers contained in Sloane’s encyclopedia 
point to a shared mathematical culture and, 
consequently, that OEIS is based as much on human 
preferences as pure mathematical objectivity.

Problem of the Sum of Three Cubes

Computer scientists and mathematicians recognize 
the appeal of the number 42 but have always 
thought that it was a simple game that could be 
played just as well with another number. Still, a 
recent news item caught their attention. When it 
was applied to the “sum of three cubes” problem, 
42 was more troublesome than all the other numbers below 100.

The problem is stated as follows: What integers n 
can be written as the sum of three whole-number 
cubes (n = a3 + b3 + c3)? And for such integers, 
how do you find a, b and c? As a practical 
matter, the difficulty in making this calculation 
is that for a given n, the space of the triplets 
to be considered involves negative integers. This 
triplet space is therefore infinite, unlike the 
computation for the sum of squares. For that 
particular problem, any solution has an absolute 
value lower than the square root of a given n. 
Moreover for the sum of squares, we know 
perfectly well what is possible and impossible.

For the sum of cubes, some solutions may be 
surprisingly large, such as the one for 156, which was discovered in 2007:

156 = 26,577,110,807,5693 + ( 18,161,093,358,005)3 + ( 23,381,515,025,762)3

Note that for some integer values of n, the 
equation n = a3 + b3 + c3 has no solution. Such 
is the case for all integers n that are 
expressible as 9m + 4 or 9m + 5 for any integer m 
(e.g., 4, 5, 13, 14, 22, 23). Demonstrating this 
assertion is straightforward: we use the “modulo 
9” (mod 9) calculation, which is equivalent to 
assuming that 9 = 0 and then manipulating only 
numbers between 0 and 8 or between 4 and 4. When we do so, we see that:

03 = 0 (mod 9); 13 = 1 (mod 9); 23 = 8 = –1 (mod 
9); 33 = 27 = 0 (mod 9); 43 = 64 = 1 (mod 9); 53 
= (–4)3 = –64 = –1 (mod 9); 63 = (–3)3 = 0 (mod 
9); 73 = (–2)3 = 1 (mod 9); 83 = (–1)3 = –1 (mod 9)

In other words, the cube of an integer modulo 9 
is –1 (= 8), 0 or 1. Adding any three numbers among these numbers gives:

0 = 0 + 0 + 0 = 0 + 1 + (–1); 1 = 1 + 0 + 0 = 1 + 
1 + (–1); 2 = 1 + 1 + 0; 3 = 1 + 1 + 1; 6 = –3 = 
(–1) + (–1) + (–1); 7 = –2 = (–1) + (–1) + 0; 8 = 
–1 = (–1) + 0 + 0 = 1 + (–1) + (–1)

You cannot get a sum of 4 or 5 (= –4). This 
restriction means that sums of three cubes are 
never numbers of the form 9m + 4 or 9m + 5. We 
thus say that n = 9m + 4 and n = 9m + 5 are prohibited values.

Searching for Solutions

To illustrate how difficult it is to find 
solutions to the equation n = a3 + b3 + c3, let’s 
see what happens for n = 1 and n = 2.

For n = 1, there is the obvious solution:

13 + 13 + (–1)3 = 1

Are there others? Yes, there is:

93 + (–6)3 + (–8)3 = 729 + (–216) + (–512) = 1

That calculation is not the only other solution. 
In 1936 German mathematician Kurt Mahler proposed 
an infinite number of them. For any integer p:

(9p4)3 + (3p – 9p4)3 + (1 – 9p3)3 = 1

This proposition may be proved using the remarkable identity:

(A + B)3 = A3 + 3A2B + 3AB2 + B3

An infinite set of solutions is also known for n 
= 2. It was discovered in 1908 by mathematician 
A. S. Werebrusov. For any integer p:

(6p3 + 1)3 + (1 – 6p3)3 + (–6p2)3 = 2

By multiplying each term of these equations by 
the cube of an integer (r3), we deduce that there 
are also infinitely many solutions for both the 
cube and double the cube of any integer.

Consider the example of 16, which is double the cube of 2. For p = 1, we get:

143 + (–10)3 + (–12)3 = 16

  Note that for n = 3, as of August 2019, only two solutions were known:

13 + 13 + 13 = 3; 43 + 43 + (–5)3 = 3

A question that naturally follows is: Is there at 
least one solution for every nonprohibited value?

Computers at Work

To answer that question, mathematicians started 
by taking the nonprohibited values 1, 2, 3, 6, 7, 
8, 9, 10, 11, 12, 15, 16 ... 
(<>A060464 in OEIS) and 
examining them one by one. If solutions can be 
found for all those examined values, it will be 
reasonable to conjecture that for any integer n 
that is not of the form n = 9m + 4 or n = 9m + 5, 
there are solutions to the equation n = a3 + b3 + c3.

The research carried out thus far, which depends 
on the power of the computers or computer 
networks used, has produced an ever expanding 
body of results. This work leads us back to the 
famous and intriguing number 42.

In 2009, employing a method proposed by Noam 
Elkies of Harvard University in[[OR: by American 
mathematician Noam Elkies in 2000, German 
mathematicians Andreas-Stephan Elsenhans and Jörg 
all the triplets a, b, c of integers with an 
absolute value less than 1014 to find solutions 
for n between 1 and 1,000. The paper reporting 
their findings concluded that the question of the 
existence of a solution for numbers below 1,000 
remained open only for 33, 42, 74, 114, 165, 390, 
579, 627, 633, 732, 795, 906, 921 and 975. For 
integers less than 100, just three enigmas remained: 33, 42 and 74.

In a 2016 preprint paper, Sander Huisman, now at 
the University of Twente in the Netherlands, 
pressed on and <>found a solution for 74:

(–284,650,292,555,885)3 + (66,229,832,190,556)3 + (283,450,105,697,727)3

In 2019 Andrew Booker of the University of 
Bristol in England 
the case of 33:

8,866,128,975,287,528)3 + (–8,778,405,442,862,239)3 + (–2,736,111,468,807,040)3

 From that point, Douglas Adams’s number was the 
last positive integer lower than 100 whose 
representation as a sum of three integer cubes 
was unknown. If there was no solution, that 
conclusion would provide a genuinely compelling 
rationale for the mathematical significance of 
42: it would be the first number for which a 
solution appeared possible but none had been 
found. Computers tried but had been unable to crack the problem.

<>The answer came 
in a 2020 preprint, the result of a huge 
computational effort coordinated by Booker and 
Andrew Sutherland of the Massachusetts Institute 
of Technology. Computers participating in the 
Charity Engine network of personal computers, 
calculating for the equivalent of more than one million hours, showed:

42 = (–80,538,738,812,075,974)3 + 
80,435,758,145,817,5153 + 12,602,123,297,335,6313

The cases of 165, 795 and 906 were also solved 
recently. For integers below 1,000, only 114, 
390, 579, 627, 633, 732, 921 and 975 remain to be solved.

The conjecture that solutions exist for all 
integers n that are not of the form 9m + 4 or 9m 
+ 5 would appear to be confirmed. In 1992 Roger 
Heath-Brown of the University of Oxford proposed 
a stronger conjecture stating that there are 
infinitely many ways to express all possible n’s 
as the sum of three cubes. The work is far from over.

The difficulty appears so daunting that the 
question “Is n a sum of three cubes?” may be 
undecidable. In other words, no algorithm, 
however clever, may be able to process all 
possible cases. In 1936, for example, Alan Turing 
showed that no algorithm can solve the halting 
problem for every possible computer program. But 
here we are in a readily describable, purely 
mathematical domain. If we could prove such 
undecidability, that would be a novelty.

The number 42 was difficult, but it is not the final step!

This article originally appeared in Pour la 
Science and was reproduced with permission.


Jean-Paul Delahaye is a professor emeritus of 
computer science at the University of Lille in 
France and a researcher at the Research Center in 
Computer Science, Signal and Automatics of Lille (CRIStAL).

Recent Articles

Mathematics of (Hacking) Passwords
Science behind Sudoku