If $x$ is chosen uniformly from $\{0,1,2,\dots,n\}$, what can one infer about $n$?

46 Views Asked by At

Here is a guessing game between two players:

  1. Player A secretly chooses a natural number $n$.

  2. A number $x$ is generated uniformly from $\{0,1,2,\dots,n\}$.

  3. Player A tells Player B the value of $x$.

  4. Player B tries to guess the value of $n$.

Question: What can Player B infer about the value of $n$?

If one sample is not enough, how about multiple samplse from $\{0,1,2,\dots,n\}$?


If we are just looking for the maximum likelihood estimator, then $p(x|n)$ is maximized whenever $n=x$, which does not seem like a good guess.

Intuitively, I thought the answer would be $x=n/2$. But if we apply Bayes theorem, we get the following parametric distribution: $$ p(x|n) = \frac{1}{n+1} $$

I assumed $n$ has an improper uniform prior: $$ p(n) \propto 1 $$

Then, applying Bayes theorem,

$$ p(n|x) = \frac{p(x|n)p(n)}{\sum_{n=0}^{\infty}p(x|n)p(n)} = \frac{\frac{1}{n+1}}{\sum_{n=0}^{\infty}\frac{1}{n+1}}$$

The denominator in this sum diverges with the harmonic series.


So far, none of these approaches seem to answer the question.

My main question is whether any information about $n$ can be inferred from $x$. What if more samples are taken?