[Math] Guessing number between 1-100 always can always be guessed in 7 guess. Why

probabilitystatistics

I'm no good at probability and statistics as this question will soon demonstrate. My question is this, I have an instructor who proved that he could guess a number between 1-100 using the divide and conquer approach. For example, I choose 7.

He: 50

Me: High

He: 25

Me: High

He: 12

Me: High

He: 6

Me: Low

He: 9

Me High

He: 8

Me High

He: 7

See, its not possible for it to take more than 7 guess if your halfway smart. My question is whats the math behind this, and how could I figure the number of guess for like 1-1000, whats the formula?

Thanks!

Best Answer

Hint: $2^7=128>100$. That is, you can simply guess in the middle and bisect until you get to the solution.

In general, just find the smallest power of $2$ greater than the max number in your set. For $1000$, you should be able to get it in $10$ guesses, because $2^{10} = 1024$.

Related Question