Deterministic convergence through ternary subdivision
Your card is:
21 cards are dealt into 3 columns of 7. The magician asks which column contains your card. The cards are gathered — with the chosen column placed in the middle. After 3 rounds, the card is always at position 11 (the exact centre of 21 cards).
After round 1: Your card is somewhere in positions 8–14 (the middle 7).
After round 2: Your card is in positions 10–12 (the middle 3).
After round 3: Your card is at position 11 (the exact middle).
Each round places the chosen group of 7 in the middle of the deck. Within that group, the card's position is also narrowed to the middle third. The three rounds of ternary subdivision converge deterministically to the centre.
The algorithm performs a base-3 digit extraction. Each round identifies one ternary digit of the card's position within the chosen column. Three rounds = three digits = uniquely identifies 1 of 33 = 27 positions. Since 21 < 27, three rounds always suffice.
Time: O(1) — exactly 3 rounds, regardless of which card is chosen
Space: O(n) where n = 21 (the card array)
This is a deterministic, non-adaptive algorithm — the same 3 steps work for any card.