Number guessing is a popular game between elementary-school kids. Teachers encourage pupils to play the game as it enhances their arithmetic skills, logical thinking, and following-up simple procedures. We think that, most probably, you too will master in few minutes. Here’s one example of how you too can play this game: Ask a friend to think of a number, let’s call it n
0. Then:
- Ask your friend to compute n1 = 3 * n0 and to tell you if n1 is even or odd.
- If n1 is even, ask your friend to compute n2 = n1/2. If, otherwise, n1 was odd then let your friend compute n2 = (n1 + 1)/2.
- Now ask your friend to calculate n3 = 3 * n2.
- Ask your friend to tell tell you the result of n4 = n3/9. (n4 is the quotient of the division operation. In computer lingo, ’/’ is the integer-division operator.)
- Now you can simply reveal the original number by calculating n0 = 2 * n4 if n1 was even, or n0 = 2 * n4 + 1 otherwise.
Here’s an example that you can follow: If n
0 = 37, then n
1 = 111 which is odd. Now we can calculate n
2 = 56, n
3 = 168, and n
4 = 18, which is what your friend will tell you. Doing the calculation 2 * n
4 + 1 = 37 reveals n
0.