This writeup suggests a possibly superior solution to the previously suggested logic problem of being handed five cards at random from a deck of cards, being allowed to choose one and hand the remaining four cards to another participant in any order you choose, with the goal that you can communicate to that other person what card you have.

Rather than going through a huge, circuitous method, actually, there's another, far simpler solution which you could use, and is also a lot more extensible (eg it can handle extra cards, such as jokers or that "rules for poker" card you get with some decks). The key is to simply realise what information you want to transmit, and what "signals" you have. While both this solution and the one previously put forward by rdude work, this solution offers a more "general" solution to the problem, removing any reliance on the presence of suits or any other feature of a normal deck of cards, and also being able to handle additional cards in the deck, such as jokers.


The information you want to transmit is what card you have. Suit/Value is part of it, but that's not really relevant to consider on its own. What you need to get to the other person is which of 52 cards you have (actually 48 if you consider the other person knows you don't have any of the four they're holding). This can most simply be done by "transmitting" a number between 1 and 52, which can quite trivially be reverted back to the card you're holding (1-13 for hearts, 14-26 for diamonds etc). If you think about it, this can be communicated using 6 bits of information, since 6 bits can communicate 64 different values.

Now, where can we get those 6 bits of data to the other person? Well, there's a lot of ways, because we have so many ways to communicate data here, but here's one example.

Card Order

Firstly, there are 4! (equal to 4x3x2x1, or 24) different ways to order the cards you give to the second participant. The simplest way for this to be applied is to treat each of the cards as if they were numbered between 1 and 4, based on their numerical value between 1 and 52 (using the same system as before, 1-13 for hearts, etc). While you could use all 24 permutations to carry data, for the sake of simplicity, it's enough to define 16 permutations. So, based on the permutation the second participant is handed, they can determine the number between 0 and 15, and convert that into a binary number between 0000 and 1111.

Handing Over Cards

Now, that's enough to get 4 bits of data across, what about the other 2? This can easily be done by the way in which you hand the cards over. To carry two bits of data (or four permutations), you can do this by how many cards you hand over at a time. For example:
Binary 00: Hand over all four cards in one go
Binary 01: Hand over the first two cards, then the remaining two cards
Binary 10: Hand over the first card, then the remaining three
Binary 11: Hand over the first three cards, then the remaining one

So you see, no variation to the order of the cards has been made above, so the 4 bits of data being transmitted by the card order is intact.

Finding the Solution

To find out what card is being held, take the 4 bits from the order of the cards, and combine it with the 2 bits from the way they're handed over, for a total of 6 bits, which can be converted into a number between 0-63 (though only numbers between 1 and 52 will be used), which will be the number of the card being held. If necessary, jokers can be found using the above method by being given numbers such as 53 or 54.


I recognise the above explanation isn't the simplest, so here's an example of how it can work:
You are handed five cards, you select one of them as you like, let's say it's the two of hearts, numbered "2" in our card numbering system. This can be converted into binary, which will be 000010 (binary 2).

You then take the remaining four cards, and calculate their numbers in the numbering scheme. Let's say hypothetically they're 10,20,30 and 40 to make things simple. Since you want to communicate 0000, you'd arrange the cards in whatever order you had preplanned to signify that (presumably 1-2-3-4), so you'd have the card "numbered" 10 first, then 20, then 30, then 40.

You then have to communicate the binary digits 10, so using the scheme shown previously, you would hand the second participant the card "numbered" 10 first. Then, you would hand them the cards "numbered" 20, 30 and 40 in the one bunch, in that order. From this the second participant will know the last two binary digits are 10.

In order to get the first four digits, your partner will examine the order of the cards they have received, and on realising they are in the order signifying 0000, will realise the whole binary number you are communicating is 000010, which is the number for the two of hearts.

So sure, you could combine all sorts of things to find the solution as in rdude's suggestion, or you could use this system, where you don't have to choose any specific card out of the five you are given, and more importantly can handle jokers or other cards.


I've just had an extremely clever suggestion (which was actually a criticism of how "easy" my suggestion can make things) from Waldemarexkul where it is in fact possible to communicate all six bits of required data solely in the "handing over the cards" stage, so that it would be possible to determine the card being retained without even having to look at the values of the cards being handed over. In addition to the two bits which can be obtained by the timing of handing over the cards, an additional four bits can be transmitted by handing over each card either face up or face down, with each card's "face up" status constituting one bit in the final calculation. Heck, with all these different ways to communicate the data required, it'd be possible to achieve this task using only four cards. So perhaps this shouldn't be the five-card logic problem, but the four-card logic problem?