The 21-coin game (take the last)
Asked at Optiver, SIG, Akuna
There is a pile of 21 coins. Two players alternate turns; on your turn you must remove 1, 2, or 3 coins. The player who takes the last coin wins.
If you move first, can you guarantee a win? What is the strategy?
Show a hint
Work backwards from the end. Which pile sizes are losing for the player who has to move from them?