All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Guess a number (Posted on 2005-04-14) Difficulty: 4 of 5
If I think of a number between 1 and 1,000, guessing it in 10 yes-no questions is easy... so that's not the puzzle!

Guessing it in 10 yes-no questions, that must be all asked in advance, is also relatively easy... so that's not the puzzle either!

How many questions would you need to guess my number, if you had to ask all questions beforehand, and I also could lie once?

See The Solution Submitted by Federico Kereki    
Rating: 4.3333 (12 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution No Subject | Comment 11 of 19 |
 

Start by asking 10 questions to determine the selected number from 1 to 1000 (or 0000000001 to 1111101000 in base-2).  When listing the questions, do the numbers in base 2 as follows:

Q0001:  Is the digit in the 1st column a "1"?

Q0010:  Is the digit in the 2nd column a "1"?

Q0011:                      3rd?

Q0100:                      4th?

Q0101:                      5th?

Q0110:                      6th?

Q0111:                      7th?

Q1000:                      8th?

Q1001:                      9th?

Q1010:  Is the digit in the 10th column a "1"?

Next find out if any of the first 10 answers are a lie:

Q11:  Did you lie on any of the first 10 questions where the digit in the 1st column of the question number is a "1"?

Q12:  Did you lie on any of the first 10 questions where the digit in the 2nd column of the question number is a "1"?

Q13: Did you lie on any of the first 10 questions where the digit in the 3rd column of the question number is a "1"?

Q14:  Did you lie on any of the first 10 questions where the digit in the 4th column of the question number is a "1"?

Answers to the last 4 questions will be as follows for a lie in each of the 14 questions:

Lie      Q11   Q12   Q13   Q14

None     N     N     N     N

1        N     N     N     Y

2        N     N     Y     N

3        N     N     Y     Y

4        N     Y     N     N

5        N     Y     N     Y

6        N     Y     Y     N

7        N     Y     Y     Y

8        Y     N     N     N

9        Y     N     N     Y

10       Y     N     Y     N

 

11       Y     N     N     N

12       N     Y     N     N

13       N     N     Y     N

14       N     N     N     Y

 

Each of the first 10 questions has a unique combination of answers for Q11 – Q14 if the answer was a lie. But the answers are not unique if the lie falls in Q11 – 14.

 

      Thus a 15th question is needed:

 

Q15: Did you lie in Q11 through Q14?

Case 1:  Yes (truth) one of Q11 – Q14 was a lie which means Q1 – Q10 were the truth

or

Case 2: Yes (lie) which means all other answers are the truth.

or

Case 3: No (truth) Q11 – Q14 were answered truthfully and they now can conclusively point which answer contained a lie.

Edited on April 15, 2005, 12:18 am

Edited on April 15, 2005, 12:51 am

Edited on April 15, 2005, 12:52 am
  Posted by Leming on 2005-04-15 00:13:39

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (23)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information