October 04, 2010

Another guess my secret number game

Here's another one of those "guess my secret number" games where the computer tells what number you thought of originally.

http://myframeshoppe.ca/math/

First you need to choose your "secret" number between 1 and 10,000.

I thought some of you might enjoy trying to figure out how it works... I enjoyed it.



By popular demand I want to share some of why it works. So DON'T READ if you want to think about why it works!



In the LAST step, the computer guesses which digit you left out. For example, maybe you put in the number as 75x711. Now, the key to "guessing" or figuring out what the missing digit is, is the fact that this number is divisible by 9. Recall that before coming to this step, you had multiplied your number by 3, and again by 3. That means you multiplied it by 9, so it is now divisible by 9.

The numbers that are divisible by nine have a special property: the sum of their digits is also divisible by nine. OK, my number 75x711 IS divisible by nine. The sum of the digits I see is 7 + 5 + 7 + 1 + 1 = 21. The next bigger number after 21 that is divisible by 9 is 27. So the digit sum must be 27, and the missing digit is 6.



The game goes like this:
1) Choose a number between 1 and 10,000.
2) Multiply it by 4.
3) Add 5.
4) Multiply it by 75.
5) Choose any two digits from your number and add the number formed by those to your number.
6) Multiply it by 3.
7) Multiply it by 3.
8) Replace one of the digits by X and submit.
9) Computer guesses your number.

I already explained how the computer finds out the missing "secret" digit. Then of course, the program can easily go backwards any step that had adding or multiplying (by doing the opposite operation).

In step 5, where you choose two digits and add them, the program isn't trying to guess what number you added. The key idea is that no matter what number you add, it's less than 100, AND the number you got in the end of step 4 is divisible by 75 and ends in 5.

So, to undo step 5, the program ONLY looks for a number that is divisible by 75, ends in 5, and is no more than 100 less than the number from step 6.
Post a Comment