0
$\begingroup$

You get get 6 attempts to find the number between 1-100. Each "attempt" can either be a guess, or a range it could fall in, responses you could receive are "Correct!", "My number is lower.", "My number is higher", or "My number is within that range".

You have 6 tries to guess it, NOT to know it.

If you can do it in less than 6 please do post it.

$\endgroup$
  • 1
    $\begingroup$ possible duplicate of Another 6 tries to guess a number between 1-100 $\endgroup$ – Ross Millikan Oct 21 '14 at 22:55
  • $\begingroup$ That's a completely different question. This one gives you range capability, that gives you equations. $\endgroup$ – warspyking Oct 21 '14 at 23:44
  • 1
    $\begingroup$ But the approach by SQB works the same way as the equations. You just want to divide the remaining possibilities in thirds (or as close as possible). Ranges are sufficient for that. $\endgroup$ – Ross Millikan Oct 22 '14 at 0:44
  • $\begingroup$ I agree with @RossMillikan, but I will refrain from voting since the other question is mine. $\endgroup$ – SQB Oct 22 '14 at 13:07
11
$\begingroup$

Divide the current range by three and guess the middle range. It's either correct, higher, or lower, which reduces your search space by ⅔. You'll go from a search space of 100 to (worst case) 34, to 12, to 4, to 2, to 1 which you can state on your 6th guess.

$\endgroup$
  • $\begingroup$ Nice, can you beat 6 $\endgroup$ – warspyking Oct 21 '14 at 20:30
  • 3
    $\begingroup$ He did, it's actually 5 guesses and one confirmed answer - if I'm correctly reading the question that is. $\endgroup$ – Tim Couwelier Oct 22 '14 at 11:03
1
$\begingroup$

It is impossible to do this with less than 6 guesses since we are guessing within 1-100. The maximum space we can guess in with less than 6 guesses is $81 = 3^{5-1}$. Less than 5 guesses would be $27$, and so on. However, you could guess in a space of up to $3^{6-1} = 243$ with 6 guesses.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.