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/Embed
Type: Question • Score: 0 • Views: 250 • Replies: 10

 
View Profile 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
 
  1  
Reply Thu 28 May, 2009 06:27 am
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?

View Profile 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
 
View Profile Setanta
 
  1  
Reply Thu 28 May, 2009 06:56 am
Cool . . . how did you accomplish that? I tried reply, but got the same post.
View Profile 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
 
  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?
  1  
Reply Thu 28 May, 2009 07:46 am
I just deleted the [ code ] [ /code ] from his post.
View Profile Setanta
 
  1  
Reply Thu 28 May, 2009 07:48 am
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.
View Profile DrewDad
 
  1  
Reply Thu 28 May, 2009 08:28 am
Do you not have the "quote" button right next to the "reply" button?
0 Replies
 
View Profile DrewDad
 
  1  
Reply Thu 28 May, 2009 08:29 am
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
How many Triangles can you find in this Image? - Discussion by Bibliophile the BibleGuru
Help with a riddle (MNI) - Discussion by youlilmidget
Lenny Conundrum Riddles and Answers - Discussion by nightmonkey
world's hardest riddle? - Discussion by dragooncancer
An Alphabet Riddle - Discussion by riddler
"The World's Hardest Riddle" - Discussion by maxlovesmarie
Frustratingly hard riddles. - Discussion by tpayne1
The worlds first riddle! - Discussion by Tryagain
 
  1. able2know
  2. » Guessing Number
Copyright © 2009 Horizontal Verticals :: Page generated in 0.33 seconds on 11/08/2009 at 11:42:05 Top End