Let be a positive integer. Anna and Beatrice play a game with a deck of cards labelled with the numbers . Initially, the deck is shuffled. The players take turns, starting with Anna. At each turn, if denotes the number written on the topmost card, then the player first looks at all the cards and then rearranges the 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.
Solution
Consider a deck with cards labeled arranged in some initial order. We need to determine under what circumstances Anna, who starts the game, has a winning strategy. The strategy depends on the number on the topmost card at each player's turn.
### Game Description:
1. At each turn, the player observes the topmost card, which has the number . The allowed move is to rearrange the top cards in any order.
2. If the top card remains as after rearrangement the same player loses, and the game ends.
### Strategy Analysis:
Let's consider what gives Anna a winning strategy:
- Anna examines the number on the topmost card. She has the freedom to rearrange the topmost cards.
- If is the smallest among these cards, any rearrangement will necessarily keep as the topmost card. This results in Anna losing immediately because the topmost card after her rearrangement is still .
However, if is not the smallest card among the top cards, Anna can always rearrange these cards such that a card smaller than becomes the topmost card, hence avoiding losing:
- This move changes the topmost card to a number smaller than , passing control to Beatrice without losing right away. With each player's optimal play, Beatrice faces the same situation: if the number on the topmost card during her turn is the smallest among the cards she can rearrange, she will lose.
Thus, Anna has a winning strategy if and only if the number on the topmost card is not the smallest of the topmost cards:
```