PROJECT EULER · #0509
Divisor Nim
Anton and Bertrand love to play three pile Nim.
However, after a lot of games of Nim they got bored and changed the rules somewhat.
They may only take a number of stones from a pile that is a proper divisora proper divisor of
E.g. if a pile at a certain moment contains
So if a pile contains one stone they can't take the last stone from it as
The first player that can't make a valid move loses the game.
Of course both Anton and Bertrand play optimally.
The triple
Let
Find
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.