Questions about “The best card trick”

Kleber's Best card trick proceeds as follows: The mark (audience member) freely selects five playing cards from a standard deck of $$52$$ and passes these five to the magician's assistant. The assistant studies those cards, returns one mystery card to the mark, and places the remaining four exposed cards, face up, in a sequence on a table. The magician then enters, inspects the sequence of exposed cards, and then correctly announces the full identity of the mystery card.

The trick works through the clever use of mathematics. The five selected cards always contain at least one suit that is represented by two (or more) cards. The assistant will choose one of these as the mystery card, and another of the same suit to be the first in the sequence of exposed cards. Thus the magician learns the suit of the mystery card.

Playing cards can be placed in a canonical order ($$\clubsuit A, 2, \ldots K, \diamondsuit A, 2, \ldots K,$$ etc.), and thus the three remaining exposed cards can be placed in $$3!$$ possible order sequences. Thus the assistant can signal six candidate card values, counting from the value of the first card (modulo 13). However, that approach alone will not cover all 12 potential card values. This issue is circumvented by the assistant being careful about which card of a pair with the same suit is given back and which is used as the first card in the sequence: use as the first card the one whose value is fewer than seven steps before the other of the same suit (modulo 13), which is the mystery card; that way the $$3!$$ possible steps ensure that the mystery card can be reached from the first card in the exposed sequence.

Question 1: How many four-card exposed sequences can arise in such tricks?

Question 2: How many sets of five selected cards have more than one acceptable sequence of exposed cards?

Background

The mark is free to choose any set of five cards, and there are of course $${52 \choose 5}$$ ways to do this. Each such set of five is guaranteed to have at least one sequence of four visible cards. Moreover, according to the algorithm, each exposed sequence leads to a unique mystery card.

Even given these facts, not all $$52!/48!$$ conceivable exposed sequences of four cards will appear. For example, the sequence $$2 \spadesuit\ 3\spadesuit\ 4 \spadesuit\ 5 \spadesuit$$ will never appear, because the inference algorithm implies the hidden card is the $$3 \spadesuit$$, which is instead in the exposed sequence.

As @IlyaBogdanov points out in a comment, any set of five selected cards that has just one suit represented by two cards will have a unique exposed sequence, and because of the uniqueness of the inference method, these must be distinct sequences. The number of such cases is $$4 {13 \choose 2} 13^3$$.

The number of cases that have two suits, each represented by two cards is $${4 \choose 2}{13 \choose 2}{13 \choose 2} 13$$, and each of these will have two distinct possible exposed sequences.

The trickier cases are when there is a single suit with $$3$$ or $$4$$ or even $$5$$ cards of that suit, and the mixture of $$3$$ cards in one suit and $$2$$ in another. The challenge is that the number of exposed sequences will depend upon the particular cards in the represented suit. For instance, even if all five cards are spades, there will be a different number of solutions in these two cases: $$\{2 \spadesuit\ 4 \spadesuit\ 6 \spadesuit\ 8 \spadesuit\ 10 \spadesuit \}$$ and $$\{2 \spadesuit\ 3 \spadesuit\ 4 \spadesuit\ 5 \spadesuit\ 6 \spadesuit \}$$.

• Maybe I don't understand the question, but isn't the answer obviously ${52 \choose 5}$? – Alex Kruckman Apr 15 at 4:33
• Nope. Can $\spadesuit 3\ \spadesuit 4\ \spadesuit 5\ \spadesuit 6$ ever be an exposed sequence? – David G. Stork Apr 15 at 4:34
• I didn't claim that every sequence of four cards was possible (this would be $52*51*50*49$), but rather that the method defines an injective function from hands of $5$ cards to sequences of $4$ cards, the image of which is the set you're trying to count. But based on your edit, I see what I was missing - based on your specification of the method, for some hands the assistant has multiple choices. – Alex Kruckman Apr 15 at 4:37
• Clearly, the 5-tuples with exactly one working sequences are exactly those with exactly one pair of cards of the same suit, and they can be counted easily. – Ilya Bogdanov Apr 15 at 8:11
• A comment about the trick itself: You can vary where the card identifying the suit appears as follows. After the assistant gives the mystery card to the mark, they add the ranks of the remaining 4 cards modulo 4 and use that number to determine the position of the suit card, which the magician can recover with the same computation. The order of the other three cards is determined by ignoring the suit card. This small addition to the trick makes it much harder for the mark to crack. – Michael Joyce Apr 15 at 16:59

The answer to Question 1 is $$52!/48! - 4 \binom{13}{2} \binom{50}{2}= 6115200$$.
That is, I claim that the number of $$4$$-tuples that cannot occur is $$4 \binom{13}{2} \binom{50}{2}$$. To see this, note that a $$4$$-tuple $$(a,b,c,d)$$ cannot occur if and only if the fifth card $$e$$ that $$(a,b,c,d)$$ signifies is among $$\{b,c,d\}$$. Note that there are $$4 \binom{13}{2}$$ choices for $$(a,e)$$. Finally, for each of the $$\binom{50}{2}$$ $$2$$-subsets $$\{x,y\}$$ of $$ \setminus \{a,e\}$$, there is a unique ordering $$(b,c,d)$$ of $$\{ x,y,e \}$$ such that $$(a,b,c,d)$$ signifies $$e$$.
As Ilya Bogdanov points out in the comments, a $$5$$-set has a unique $$4$$-tuple if and only if it contains exactly one pair of cards of the same suit. The number of such $$5$$-sets is $$4 \binom{13}{2}13^3$$. Thus, the answer to Question 2 is $$\binom{52}{5}-4 \binom{13}{2}13^3= 1913496$$.
• Thanks... but I'm a little confused by your answer. Could you explain why in your last sentence this issue is the "unique ordering $(b,c,d)$ of $\{x,y,e\}$"? As you rightly point out, $e$ can never be in the exposed 4-tuple, so the ordering of it among $(b,c,d)$ seems inappropriate. – David G. Stork Apr 16 at 0:15
• I am counting 4-tuples that cannot occur, so $e$ is $b, c$, or $d$. – Tony Huynh Apr 16 at 1:47
• OK. Thanks. Makes sense. (+1)... and await the full answer to both questions for a $\checkmark$. – David G. Stork Apr 16 at 1:49