42: The Number With No Hidden Significance
Abstract
In Douglas Adams’s The Hitchhiker’s Guide to the Galaxy, a supercomputer called Deep Thought calculates for 7.5 million years and announces that the answer to “the Ultimate Question of Life, the Universe, and Everything” is 42. Adams chose 42 deliberately because it was a “perfectly ordinary small number” with no significant mathematical or cultural associations. He explicitly denied any deeper meaning. Programmers worldwide adopted 42 as the canonical example number in code, documentation, and demonstrations, partly as a joke, partly because having a universal placeholder number is genuinely useful. The cultural adoption of 42 is one of the most complete transitions of a literary reference into technical practice.
The Origin
Douglas Adams wrote The Hitchhiker’s Guide to the Galaxy originally as a BBC radio comedy (1978), then adapted it into a novel (1979). The “42” answer was written for the radio script. Adams later described the selection process:
“The answer to this is very simple. 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.”
He repeatedly denied the various numerological analyses that fans constructed: 42 in base 13 is 6 × 9 in base 10 (which would make 6 × 9 = 42 true in that base, an elegant recursion that Adams said was coincidental), 42 is the angle at which a rainbow is formed, there are 42 laws of cricket, etc. Adams found these analyses funny but irrelevant.
The Technical Adoption
Programmers adopted 42 as a magic number in examples and demonstrations, replacing the more generic foo and bar in contexts where a specific value was needed:
# Example: The answer
answer = 42
print(f"The answer is {answer}")The adoption was partly humor (programmers tend to know the reference) and partly practical (a specific non-zero integer constant that reads as obviously arbitrary avoids confusion with meaningful values like 0, 1, or 100).
Placeholders of this kind are a general habit in technical writing: RFC 5737 reserves 192.0.2.0/24 and two other ranges purely so documentation can show IP addresses that route nowhere, and example.com exists for the same reason. What is unusual about 42 is that it was never reserved by anybody. It spread on the strength of a joke, and it now appears in tutorials, test fixtures, and API samples across every language, wherever an author needs a number that obviously means nothing.
The Self-Referential Result
The most satisfying aspect of the “42” phenomenon is that Douglas Adams inadvertently created exactly what Deep Thought calculated: a meaningless number that humans insist on finding meaning in. Every generation of Hitchhiker’s fans discovers new connections that Adams denied. The number’s emptiness produces interpretive activity, as if the interpretations are searching for the Ultimate Question to match the existing answer.
Adams died in 2001, before programmers’ use of 42 became as widespread as it is today. He would likely have found it both gratifying and exactly the right kind of absurd.
📚 Sources
- Adams, Douglas: The Hitchhiker’s Guide to the Galaxy (1979), Pan Books
- Adams, Douglas: post to the Usenet group alt.fan.douglas-adams, 3 November 1993 (“It was a joke… I sat at my desk, stared into the garden and thought ‘42 will do’”)
- Phrases from The Hitchhiker’s Guide to the Galaxy — Wikipedia (on the 42 explanation and the base-13 coincidence)
- Simpson, M.J.: Hitchhiker: A Biography of Douglas Adams (2003), Justin, Charles & Co.