# Puzzle 69 |The Number Game

Ankur and Vijay are fond of playing Number games. In one of the games, Ankur has to choose a number X, such that X belongs to [1, 10000] . Vijay has to guess the chosen number as soon as possible. Ankur will let Vijay know whether his guess is smaller than, larger than or equal to the number. The warning is that Vijay loses the game if his guess is larger than Ankur’s chosen number two or more times.

Q1. How to make guesses, and how many guesses are necessary?

Q2. What if Ankur is allowed to pick a very large positive number without any given limits ? .

**Solution:**

Both the problems can be treated in the following ways:

**Ans1:**

When Ankur chooses a number between 1 and n, here n=10000, Vijay should start guessing √n, 2√n, 3√n, 4√n, and so on. The first time his guess exceeds Ankur’s number, the range of numbers has been narrowed down to √n numbers; he then starts guessing sequentially in that range.

**Ans2:** If Ankur guesses an arbitrarily large number n, then Vijay may guess 1, 4, 9, 16, 25, and so on, to discover k such that Ankur’s number lies between k^2 and (k+1)2. Then guess k2+1, k2+2, k2+3 and so on. On the whole, this requires O(√n) steps.

This puzzle is contributed by **Praveer Satyam.** Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

## Recommended Posts:

- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the poisoned wine)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)
- Puzzle 15 | (Camel and Banana Puzzle)