As per usual, the code came easily once I correctly understood what the question was asking for. Numgame posits that the players will play optimally and I misinterpretted that to assume they would play to finish as quickly as possible. My code had the players always subtracting the largest divisor of N from N. The correct way to play to win would be to always pass your opponent an odd number whenever possible. The divisors of odd numbers will always be odd. Subtract an odd number from an odd number and you get an even number. If you pass your oponent an odd number you will always be passed an even number in return. If you pass your oponent an even number they can choose to pass you either an odd number or an even number. Deny your opponent the choice and always receive even.