Let be the number of 1’s when writing the numbers from 0 to in binary.
For example, writing 0 to 5 in binary, we have . There are seven 1’s, so .
The sequence starts .
A game is played by two players. Before the game starts, a number is chosen. A counter starts at 0. At each turn, the player chooses a number from 1 to (inclusive) and increases by that number. The resulting value of must be a member of . If there are no more valid moves, then the player loses.
For example, with and starting with :
Player 1 chooses 4, so becomes .
Player 2 chooses 5, so becomes .
Player 1 chooses 3, so becomes .
etc.
Note that must always belong to , and each player can increase by at most .
Let be the highest number that the first player could choose at the start to force a win, and if there is no such move. For example, , , and .
It can be verified that for .
Find for .
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.