Suppose I have $21$ playing cards. I distribute them in $3$ columns and tell you to choose mentally a card. Then just indicate in which column the card is.
I pick up one of the columns which doesn't contain your card, then the column which contains your card then the remaining column.
Now I deal the cards in $3$ columns again, starting from the left to the right, and repeating the process until there are no cards left in my hand. I ask you to indicate to me in which column your card is.
I repeat step 2 then 3.
I repeat step 2.
Now by counting either way in the deck of $21$ cards, your card will be the 11th card.
I've tried using modulo to understand the problem but I'm stuck doing integer divisions. So does anyone have a simpler way to explain the trick.
Also could anyone explain why it works only for odd number of cards in each column and why it requires additional steps for more cards. e.g for $17 \cdot 3 = 51$ requires an additional step compared with $21$ cards?
EDIT: I forgot to add that the number of cards you have to count for the final step equals
$$1.5\text{ times the number of cards in each column} + 0.5$$