Star Trek often refers to 47 and Star Trek made a sport out of finding real or imagined references to 47. Why did Douglas Adams pick 42 as the ultimate answer in the Hitchhikers guide to the galaxy?
According to Douglas Adams himself:
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.
Source: Wikipedia article
On a day when he was less tired of the question than when he gave the quote in @GoranJovic’s answer, Douglas Adams went into more detail about how he chose 42:
I wanted a nice, ordinary number, one that you wouldn’t mind taking home and introducing to your parents.
Yes, the answer to the universe really is 42, The Independent
The joke, like much of Adams’ humour, aims for bathos (“an abrupt, unintended transition in style from the exalted to the commonplace”), so the number has to feel utterly ordinary, to contrast with the grandiose idea of a meaning to existence.
Here’s an extract from M. J. Simpson’s Douglas Adams biography (on a Procul Harum fan site, of all places) that discusses his thought process in more detail:
What is the most ordinary, workaday number you can find? I don’t want fractions on the end of it. I don’t even want it to be a prime number. And I guess it mustn’t even be an odd number. There is something slightly more reassuring about even numbers. So I just wanted an ordinary, workaday number, and chose 42.
Procol-oriented extracts from MJ Simpson's authoritative book
Procol Harum - Beyond the Pale
Personally, I think the rhythm of the syllables, and the soporific “or” sound in ”forty”, help to create this “workaday” quality. Forty-two, dum-de-dum. It sounds frumpy.
Also, the second digit (2) is half of the first digit (4) and has half the syllables, which I think adds to the sense of quiet anticlimax.
As some people remarked, it's very likely that Adams had deeper reasons for choosing 42, but was disinclined to share them. Stephen Fry claims that this was the case.
"Of course, it would be unfair for me to comment," he confides. "Douglas told me in the strictest confidence exactly why 42. The answer is fascinating, extraordinary and, when you think hard about it, completely obvious. Nonetheless amazing for that.
"Remarkable really. But sadly I cannot share it with anyone and the secret must go with me to the grave. Pity, because it explains so much beyond the books. It really does explain the secret of life, the universe, and everything."
Personally, I think Fry was pulling our leg. But I also think it's a relevant answer to this question.