The Cave and the Terminal

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.

(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:

• What's the distribution over the distributions? – Deusovi Dec 23 '15 at 0:12
• "where each distribution is equally likely" - not possible. There is no uniform distribution over a countable set. – user2357112 supports Monica Dec 23 '15 at 0:26
• @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. – Todd Wilcox Dec 23 '15 at 6:39
• @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.) – user2357112 supports Monica Dec 23 '15 at 7:17
• 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. – S.C. Dec 23 '15 at 7:26

Explanation

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.

• This assumes a uniform random distribution over $\mathbb{N}$ for N, which is not possible. – Deusovi Dec 23 '15 at 0:12
• if the maximum number is 42, why is the door still sealed? -___- the 42 is already entered in the terminal – Ceeee Dec 23 '15 at 2:10
• @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. – 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.

• 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. – Zandar Dec 23 '15 at 3:30

The answer (without looking) must be:

42

Because:

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

42

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.