Average number of guesses for simple game The guess-a-number game starts with one player (the chooser) picking a number
between 1 and 100 (inclusive) and secretly writing it down. The other player
(the guesser) attempts to guess the number. After each guess, the chooser responds
with “correct” (the guesser guessed the number and the game is over),
“higher” (the actual number is higher than the guess), or “lower” (the actual
number is lower than the guess).

What is the average number of guesses the guesser will need to find the number given that he uses the optimal, most efficient strategy?

I found that it will be 6 guesses $29/32$ times and 7 guesses $3/32$ times using the most clumsy method ever which I won't post. It can be no more than 7 since $2^7=124&gt;100$.

It was like 

$(100-1)/2 = 49.5, \\(49-1)/2 = 24,  \\(50-1)/2 = 24.5 \\-&gt; 24, 25 $ 

with 24 $3/4$ of the time and 25 $1/4$ of the time, etc etc etc.

What is a better way (since the method had so many opportunities for error I'm probably wrong anyway)?
If you want to split the interval, your first guess should be $\frac {100+1}2=50.5$ You can be a bit more efficient by making your guesses whole numbers, giving a chance of getting "correct". early.  So if your first guess is $50$, you get away with $1$ guess $1/100$ of the time, while if you guess $50.5$ you lose the chance to be lucky.  You have $2/100$ chance of winning in two guesses, $4/100$ chance in three, and so on.  Other than that, binary search cannot be beaten.
The average number of guesses would be ~5.80905. As the analytical approach to solving this would be rather extensive, the answer could be estimated with a simple simulation, in which the program follows the optimal strategy of cutting the set of values in half by selecting the mid point, and then we average the number of trials after a large number of iterations.
n &lt;- 100
count&lt;-c() 

for (i in 1:100000){
  
  s &lt;- round(runif(1,0.5,n+0.5),0)
  iter &lt;- 1
  guess &lt;- trunc(n /2)
  iter_par &lt;-trunc(guess/2)
  
  while (guess!= s){

    ifelse(guess&lt;s,guess&lt;-guess+iter_par,guess&lt;-guess-iter_par)
    iter_par&lt;-round(iter_par/2,0)
    ifelse(iter_par&lt;1,iter_par&lt;-1,iter_par&lt;-iter_par)
    iter&lt;-iter+1
  }
  
  count&lt;-append(count,iter)  
 
}

mean(count)