How many "Yes or No" questions are needed to guess any 7 digit phone number?
Solution to Problem:
The answer is 24 questions.
Use what is known as a "binary search" to ask the
questions.
Your first question would be:
Is the number greater than 5000000?
This would divide the 10 million possible phone numbers (from 000-0000
to 999-9999) in half with just one question.
Each succeeding question would divide the remaining numbers in half.
So we are looking for the solution to the equation
2x = 10000000
You can solve this with logarithms:
x ln 2 = ln 10000000
so x = 23.25
therefore, it would take 24 questions to be absolutely sure that you
would be able to guess any 7-digit phone number.
OR, of course, you could just examine
224 = 16,777,216 and 223 = 8,388,608 to see that 24 questions are needed.
Correctly solved by:
1. Tom Kelley | Winchester, VA |
2. Joe Vance | Winchester, VA |