The twenty-one card trick is a procedure that locates a selected card among 21 distinct cards by repeatedly dealing them into three columns and placing the column containing the selection between the others (Hoffmann, pp. 43-44).
Starting with the cards in any order, deal successive rows from left to right into three columns of seven, with earlier cards above later ones in each column. Ask which column contains the selection, then collect the columns into a single packet with that column in the middle, preserving the top-to-bottom order within each column. After three such rounds, the selection is the eleventh card from the top.
To verify this, let be the position of the selection from the top after
rounds, with the initial position
between 1 and 21. On the next deal,
its row is
,
where
is the ceiling function. Collecting its column
between two packets of seven therefore gives
The first round gives , the second gives
, and the third gives
(Deb 2018, pp. 6-7).