Intrinsically, 42 does have a few things going for it. One fun fact is that you can build a 3x3x3 magic cube with each number from 1 to 27 appearing exactly once, and every row, column, and diagonal summing up to 42. 42 is also the 5th Catalan Number, which means that 42 is the number of triangulations of a heptagon, or the number of ways you can cut a heptagon into triangles using straight lines. (You may recall that a heptagon is a 7-sided regular polygon.) It's a Harshad number, or an integer divisible by the sum of its digits. There are also many more obscure properties of this number, too numerous to list here.
Science provides some more cool applications of this number. In 1268, English philosopher Roger Bacon calculated the geometric properties of rainbows, and discovered that the summit of a rainbow cannot appear more than 42 degrees above the horizon. More recently, in 1966, mathematician Paul Cooper calculated that if you bore a frictionless hole all the way through the earth and try to travel to China by just jumping in and using gravity, the trip would take you exactly 42 minutes. Surprisingly, this calculation works even if your hole doesn't pass through the center of the earth: the reduction in gravitational force and distance traveled exactly balance each other out.
The number 42 also appears in various places in religion and culture. It's unlucky in Japan, since the name of it sounds like the words for "unto death". In ancient Egypt, there were 42 principles of Ma'at, or religious laws. In the Christian book of Revelations, the Beast will hold dominion over the Earth for 42 months. The Jewish Talmud references the "42-lettered name of god", and perhaps most relevant, Kabbalistic tradition makes the related claim that this number was somehow used by God to create the universe.
The Wikipedia article also points out that Lewis Carroll, popular 19th-century author of lighthearted math-influenced works, used the number 42 numerous times: 42 illustrations in "Alice in Wonderland", the rule 42 in the same book (requiring all persons more than a mile high to leave the court), 42 boxes in The Hunting of the Snark, and a few other places.
One more intriguing possiblity is that a semi-serious guide book from the 1970s and source of Adams's title, "The Hitchhiker's Guide to Europe", mentioned that travelers to the UK looking for family roots were likely to find the answers disappointing. And that comment was on page 42.
So, were one of these the reasoning as to why Adams chose 42 as the ultimate answer? These possibilities, mostly included on the wikipedia page linked in the show notes, all have some level of plausibility. That page also includes various other references to 42, too numerous to include here. But these just scratch the surface-- while doing online research for this podcast, I found that author Peter Gill wrote a whole book on the topic, which I haven't yet read.
On the other hand, most of these references to the number are what I would describe as, well, very miscellaneous at best. There's no overarching theme that really convinces me that 42 is a good candidate for the answer to the universe. I would bet that with a little research, I could find an equal number of properties and references to any other two-digit number you might select. Think about it: in any instance where a number less than 100 appears in history, religion, or even some mathematical grouping, there's roughly a 1% chance that it's the number you want!
So my inclination is to guess that Adams was playing a massive joke on the public, and really did choose the number randomly, just to see what interpretations his readers would come up with. Since the author is no longer with us, we never will know for sure.
And this has been your math mutation for today.