0
   

Guessing Number

 
 
Reply Thu 28 May, 2009 06:15 am
Code:
Let n be a positive integer, and x an unknown non-negative integer less than n. Suppose you may make guesses for the value of x, and after each guess you are told whether it is correct, too low, or too high. How large may n be so that you can still guarantee to make a correct guess within 20 guesses?

  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,591 • Replies: 10
No top replies

 
Setanta
 
  1  
Reply Thu 28 May, 2009 06:21 am
Post your postulate again, and leave out the silly "code" command. As it stands now, no one can read the entire postulate.
0 Replies
 
McGentrix
 
  1  
Reply Thu 28 May, 2009 06:27 am
@rohtarantula,
rohtarantula wrote:

Let n be a positive integer, and x an unknown non-negative integer less than n. Suppose you may make guesses for the value of x, and after each guess you are told whether it is correct, too low, or too high. How large may n be so that you can still guarantee to make a correct guess within 20 guesses?

DrewDad
 
  1  
Reply Thu 28 May, 2009 06:49 am
Just as an initial guess, i'd say 2^20 or 2^21. Maybe 1+2^20 or 1+2^21....
0 Replies
 
Setanta
 
  1  
Reply Thu 28 May, 2009 06:56 am
@McGentrix,
Cool . . . how did you accomplish that? I tried reply, but got the same post.
DrewDad
 
  2  
Reply Thu 28 May, 2009 07:00 am
I assume that you want to optimize your guesses. It would be silly to guess "1", "2", "3", etc.

When you're down to one guess, there has to be only one answer possible.

For two guesses, there should be three possible answers (a midpoint, and one possible value on either side). Therefore, If you have two guesses, then the largest that n can be is 4.

For three guesses, there must be a midpoint and three values on either side, so n has a maximum value of 8.

For four guesses, a midpoint and a range of seven numbers on either side, so n can be 16.

So it looks like the maximum value of n is two raised to the power of the number of guesses, so 2^20.


0 Replies
 
rohtarantula
 
  1  
Reply Thu 28 May, 2009 07:13 am
The correct answer is (2^20)-1 .
Another cool one.

Let n be a positive integer, and x an unknown non-negative integer less than n. Suppose you may ask questions of the form "Is x less than t?", where t is an arbitrary integer, but the answer to each question will be told only after you ask another question (i. e., the answers are delayed by one question; note that the last question will not be answered at all). How large may n be so that you can still guarantee to determine x with only 30 questions?
McGentrix
 
  1  
Reply Thu 28 May, 2009 07:46 am
@Setanta,
I just deleted the [ code ] [ /code ] from his post.
Setanta
 
  1  
Reply Thu 28 May, 2009 07:48 am
@McGentrix,
That's fine, as far as it goes . . . but i've never seen a way to quote a post, other than to hit "reply" and the copy and paste the text into ubb code for a quote. Perhaps you could enlighten me further.
DrewDad
 
  1  
Reply Thu 28 May, 2009 08:28 am
@Setanta,
Do you not have the "quote" button right next to the "reply" button?
0 Replies
 
DrewDad
 
  1  
Reply Thu 28 May, 2009 08:29 am
@rohtarantula,
rohtarantula wrote:
The correct answer is (2^20)-1 .

And how did you determine that?
0 Replies
 
 

Related Topics

Alternative Einstein's riddle answer - Discussion by cedor
Urgent !!! Puzzle / Riddle...Plz helpp - Question by zuzusheryl
Bottle - Question by Megha
"The World's Hardest Riddle" - Discussion by maxlovesmarie
Hard Riddle - Question by retsgned
Riddle Time - Question by Teddy Isaiah
riddle me this (easy) - Question by gree012
Riddle - Question by georgio7
Trick Question I think! - Question by sophocles
Answer my riddle - Question by DanDMan52
 
  1. Forums
  2. » Guessing Number
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.04 seconds on 04/26/2024 at 11:25:28