Another Information Theory Riddle

896 Views Asked by At

The following nice riddle is a quote from the excellent, free-to-download book: Information Theory, Inference, and Learning Algorithms, written by David J.C. MacKay.

In a magic trick, there are three participants: the magician, an assistant, and a volunteer.

The assistant, who claims to have paranormal abilities, is in a soundproof room. The magician gives the volunteer six blank cards, five white and one blue. The volunteer writes a different integer from 1 to 100 on each card, as the magician is watching. The volunteer keeps the blue card. The magician arranges the five white cards in some order and passes them to the assistant.

The assistant then announces the number on the blue card.

How does the trick work?

3

There are 3 best solutions below

4
On BEST ANSWER

The five cards are uniquely identified by their numbers (low to high). There are $5!=120$ possible orderings for the five cards, which is more than enough to encode the number on the sixth card. In fact, by orienting the cards carefully, there are 4 ways to orient each card and still make a pile (180 degree rotation, turn upside down), there could be $4^55!=122880$ possibilities. I'd only try this variation with a lot of practice, though.

1
On

The actual numbers written on the white cards don't matter, let's call them, in increasing order, $C_1,C_2,\dots,C_5$. There are $5!$ permutations of $\{1,2,\dots,5\}$, enough to encode all the numbers from $1$ to $120$.

The code (for $120$) could go as follows. If $C_1$ is the top card, then the hidden card is in the range $1$ to $24$; if it is $2$, the hidden card is $25$ to $48$, and so on. Then the range identified by the top card is narrowed down by considering the next card. And so on. With some practice the "reading" would be quick.

1
On

Using @vadim123 's orientation trick, you can encode 2 bits of information per card, regardless of the number written on them and the ordering of the cards. $100<2^7$, so only 3 cards + $Boolean(Sorted) $ suffice for the encoding. :P

I wonder what is the encoding that absolutely minimizes the "resource utilization"... (I wish I had the rep. to start a bounty) :P