# guessing a number between 1 and 100

Person A chooses an integer between 1 and 100 at random, then B can guess that number in (at most) 7 attempts, i.e. $$\log_2(100)+1=7$$. What if now A chooses an integer from a distribution that is known to B (B knows the probability of each number being selected but does not know the number). Can B use this extra information to guess that number in fewer attempts? What would be the best strategy here?

• Isolate the half of the integers with the greatest probability. First question is whether the chosen integer is one of them. – BruceET Jul 24 at 3:33
• @dynamic89 I believe you mean something like $\lceil \log_2(100)\rceil+1=7$. What you write as an equality is not. – Glen_b Jul 24 at 10:50
• @Glen_b that's exactly what I mean! Thanks! It's just from binary search. By the way I have a thought... instead of splitting the array in half, we could spilt the array at the point where the sum of the weights on the left equal to the sum of the weights on the right. However the worst case is the same as before but hopefully this is better in expectation? – dynamic89 Jul 24 at 13:14
• Entropy is your friend :-). Generally, the answer depends on how many times A can play this game and what the payoff is. Perhaps you have in mind a strategy with the smallest expected number of attempts? – whuber Jul 24 at 13:39
• – whuber Jul 24 at 16:34