A magic trick - find out the fifth card if four is given
There is in fact a solution which uses your idea: that some suit will be repeated twice.
Say that among the $13$ ranks within a suit, ordered $A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K$, each rank "beats" the next six ranks, wrapping around when we get to the end. For example, $A$ beats $2,3,4,5,6,7$, and $10$ beats $J, Q, K, A, 2, 3$.
If you have two cards of the same suit, exactly one of them beats the other one. So you should pass, in order:
- A card of the same suit as the missing card, which beats the missing card. This leaves six possibilities for the missing card.
- The remaining three cards, in an order that encodes which of the six possibilities it is.
For the second step, we should order all $52$ cards in the deck somehow; for instance, say that $\clubsuit < \diamondsuit < \heartsuit < \spadesuit$ and $A < 2 < 3 < \dots < Q < K$. Then the order of the last three cards is one of "Low, Middle, High", "Low, High, Middle", and so on through "High, Middle, Low". Just remember some correspondence between these six possibilities and the values $+1, +2, +3, +4, +5, +6$, and add the value you get to the rank of the first card (wrapping around from $K$ to $A$ of the same suit).
For example, say that the correspondence we chose in the second step is
\begin{array}{ccc|c} \text{Low} & \text{Middle} & \text{High} &+1 \\ \text{Low} & \text{High} & \text{Middle} &+2 \\ \text{Middle} & \text{Low} & \text{High} &+3 \\ \text{Middle} & \text{High} & \text{Low} &+4 \\ \text{High} & \text{Low} & \text{Middle} &+5 \\ \text{High} & \text{Middle} & \text{Low} &+6 \end{array}
and you draw the cards $\{4\clubsuit, 5\spadesuit, 5\diamondsuit, A\clubsuit, J\spadesuit\}$.
- We have two possibilities for the repeated suit, so let's choose $\spadesuit$.
- In the cyclic order in that suit, $5\spadesuit$ beats $J\spadesuit$, so the first card we pass is $5\spadesuit$.
- We want to encode the offset $+6$, which is the ordering High, Middle, Low.
- So we pass that ordering: after $5\spadesuit$ we pass $5\diamondsuit, 4\clubsuit, A\clubsuit$ in that order, because $5\diamondsuit > 4\clubsuit > A\clubsuit$.
Let $S$ be a set of all cards.
So we have a set $A$ of all ordered $4$-couples of the set $S$ and a set $B$ of all $5$ subsets of the set $S$.
Connect 4-couple in $A$ with a subset in $B$ iff all four card from that 4-couple are in that subset. Clearly each 4-couple is connected to $8$ 5-subsets and every 5 subset is connected to $5!= 120$ 4-couples.
This relation give us a bipartite graph $G=(A,B)$. Now this graph satisfies Hall matching condition. Take any subset $X$ in $B$. Then the set of neighbours $N(X)$ satisfies: $$48 \cdot |N(X)| \geq 120\cdot |X|\implies |N(X)|\geq |X| $$ So there exist a matching which saturate all vertices in $B$.
It's a cute one. Let's just assume the cards are numbered $\{1 \dots 52\}$. We draw cards $a_1 < a_2 < a_3 < a_4 < a_5$, and hand out in this order $b_1, b_2, b_3, b_4$. The way we order this set $B={b_1, b_2, b_3, b_4}$ already allows to transmit quite some information. Indeed, choosing the orders paramounts to choosing a permutation on the 4 elements of $B$. There are $4! = 4 \cdot 3 \cdot 2 \cdot 1 = 24$ such permutations.
This is not enough still to transmit the $5$th which is in a set of size $52$. Well, we also know that the 5th card is different from those $4$ firsts ones: there is only $52-4 = 48$ possibilities.
I'll leave it to you to complete the strategy. Note that $48/24 = 2$, so we just need to find a trick to only half the search space. Note also that we have still not fixed how we choose the secret card among the set $A$. At last, note at least one of the two inequalities:
- $a_2 \leq 25$
- $a_4 \geq 58-25$.