This is a magic trick performed by two magicians, A and B, with one regular, shuffled deck of 52 cards. A asks a member of the audience to randomly select 5 cards out of a deck. the audience member  who we will refer to as C from here on  then hands the 5 cards back to magician A. After looking at the 5 cards, A picks one of the 5 cards and gives it back to C. A then arranges the other four cards in some way, and gives those 4 cards face down, in a neat pile, to B. B looks at these 4 cards and then determines what card is in C's hand (the missing 5th card). How is this trick done?

Note 1: There's no secretive message communication in the solution, like encoded speech or ninja hand signals or ESP or whatever ... the only communication between the two magicians is in the logic of the 4 cards transferred from A to B. Think of these magicians as mathematicians.
Note 2: This magic trick is originally credited to magician and mathematician Fitch Cheney.
Number the cards 152 (maybe 113 hearts, 1426 spades, 2739 diamonds, 4052 clubs)
Lets say the cards picked are A<B<C<D<E
We can remove any card so lets make it D. We then need to encode the number D3 since there are 3 smaller cards.
The 4 cards we get to hand back can be placed in any of 24 different orders. According to a simple numbering scheme:
ABCE=1
ABEC=2
ACBE=3
...
ECBA=24
The numbers go from smallest possible order to largest.
If we need to encode 25 through 48 the cards should be handed back sideways. (Hopefully this isnt a typical ninja move) In this case we add 24.
To decode the missing card. The 2nd magician must decode the number (adding 24 if needed) then add 1 for each card with a lower value than this.
Example: cards 5,7,28,29,50
Remove card 28. We need to encode the number 26. This is 24+2 so we put the cards in the second order 575029 and hand them back sideways.
The receiving magician notes the sideways cards. Sees they are in order #2 and realizes hes been sent the number 26. Two of these cards are lower so he adds 26+2=28. And says: 2 of diamonds.
[I note there may be a problem if we pick a card which is one or two more than another card. So in my example we would not choose to remove the 29.]

Posted by Jer
on 20090529 14:10:41 