Wednesday, January 22, 2014

The Mind Reader, Part II

Below you can access an amazing algorithm. It runs remotely on a server park of quantum computers. By giving the algorithm only one number, it will know which two random numbers you picked! It does this using quantum-mechanical phenomena such as superposition and entanglement. Just follow the steps in this game and you'll see it's true!

How does it work you wonder? Well, simply put, the algorithm utilises the probabilistic nature of its quantum operations so that the two numbers can be measured once the quantum state collapses.

Naah — just kidding. All there is to it is some simple algebra.

What's happening is that the two numbers are being encoded into one single number, while making sure the process can always be reversed (i.e. that number can be decoded). Let's take a look at the ‘easy version’. Basically, each step constructs a formula.

StepIn formula
Pick a number A (0..9)A
Double the number (×2)2A
Add five2A + 5
Multiply by five10A + 25
Pick another number B (0..9) and add it10A + B + 25
Enter the result RR = 10A + B + 25

From the entered result R, the number 25 can be subtracted again. We then know the result of 10A + B. Knowing that A and B are both single digits, and assuming that R is a 2-digit number, try and think of what that means. It means that A represents tens and thus is always the first digit, and B represents singles and thus is always the second digit. And this is how can you can decode the number.
(Note that when the result is a single digit number, it must mean that A = 0.)

An example. We pick three. Double it: 6. Add five: 11. Multiply with five: 55. Pick and add nine: 64. To return the individual numbers, substract 25, which is 39. Yup! 3 and 9 were the numbers picked.

The difficult version works exactly the same, except both numbers can have up to 3 digits. The formula is:
1000A + B + 308625

No comments:

Post a Comment