Wandering around the Mojave Wasteland, you stumble upon cave with a sealed door. In the cave, there is a terminal glowing mysteriously in greenish light.

enter image description here

(Not the actual terminal)

Looking closer, you see that it is displaying the number 42. You know from the quest that the number has been drawn from a random uniform distribution (1 to N, where each distribution is equally likely). To enter the door you must enter the maximum number N of this distribution. Which is the most likely?

Enter number N:

  • 3
    $\begingroup$ What's the distribution over the distributions? $\endgroup$ – Deusovi Dec 23 '15 at 0:12
  • 5
    $\begingroup$ "where each distribution is equally likely" - not possible. There is no uniform distribution over a countable set. $\endgroup$ – user2357112 supports Monica Dec 23 '15 at 0:26
  • 1
    $\begingroup$ @user2357112 Do you mean countably infinite? All finite sets are countable, therefore there are a countable number of countable (and finite) sets which can have a uniform distribution on them. $\endgroup$ – Todd Wilcox Dec 23 '15 at 6:39
  • $\begingroup$ @ToddWilcox: Whoops, you're right, I misspoke. I could pretend I was using the convention where "countable" means "countably infinite", but I've always preferred the "finite or countably infinite" definition. (The number of finite sets isn't countable, though.) $\endgroup$ – user2357112 supports Monica Dec 23 '15 at 7:17
  • 1
    $\begingroup$ I would really appreciate if anyone could explain to me what a random uniform distribution (1 to N, where each distribution is equally likely) actually means. $\endgroup$ – S.C. Dec 23 '15 at 7:26

The answer is 42.


If it was chosen in the range [1,42], then the probability is 1/42. If it was larger, for instance 43, it would be 1/43. It cannot be smaller than 42 for obvious reasons.

  • 2
    $\begingroup$ This assumes a uniform random distribution over $\mathbb{N}$ for N, which is not possible. $\endgroup$ – Deusovi Dec 23 '15 at 0:12
  • $\begingroup$ if the maximum number is 42, why is the door still sealed? -___- the 42 is already entered in the terminal $\endgroup$ – Ceeee Dec 23 '15 at 2:10
  • $\begingroup$ @Deusovi In a sense, you implicitly assume the problem can be modeled by probability theory. However, your comment points out precisely why that cannot be. $\endgroup$ – Fimpellizieri Dec 23 '15 at 7:13

This is apparently a well known problem.

Citing Wikipedia, I claim 84 (specifically, 2m = 2*42 = 84). Although other statistics might also argue for 42.

  • 2
    $\begingroup$ This approach seems to be about calculating the value of N which will give the smallest average error, not the value which is most likely. $\endgroup$ – Zandar Dec 23 '15 at 3:30

The answer (without looking) must be:



any number higher gives it a lower probability of 42 occurring


A important piece of unspecified information is the prior distribution of N. To determine the best guess for N, we'll need to guess something about this distribution. Intuitive leaps are often important on quests.

My guess is that

The prior probability distribution of N is monotonically decreasing. In other words, P(A) < P(B) if A < B. This allows distributions such as P(N) = $2^{-N}$, a poisson distribution, and many others.

If this is true, the answer is


This is because

The posterior probability for any number A>=42 is proportional to P(A)/A, and P(42) > P(B) for all B > 42, so the posterior propability of A=42 is the highest.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.