Problem

Source: MEMO 2022 I2

Tags: combinatorics



Let $n$ be a positive integer. Anna and Beatrice play a game with a deck of $n$ cards labelled with the numbers $1, 2,...,n$. Initially, the deck is shuffled. The players take turns, starting with Anna. At each turn, if $k$ denotes the number written on the topmost card, then the player first looks at all the cards and then rearranges the $k$ topmost cards. If, after rearranging, the topmost card shows the number k again, then the player has lost and the game ends. Otherwise, the turn of the other player begins. Determine, depending on the initial shuffle, if either player has a winning strategy, and if so, who does.