PROJECT EULER · #0859
Cookie Game
Odd and Even are playing a game with
The game begins with the
Odd's turn: Odd may choose any pile with an odd number of cookies, eat one and divide the remaining (if any) into two equal piles.
Even's turn: Even may choose any pile with an even number of cookies, eat two of them and divide the remaining (if any) into two equal piles.
The player that does not have a valid move loses the game.
Let
For example,
You are also given
Find
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.