start is written on a board.
On a turn, the player picks a divisor d of the current number x with 0 < d < x and x divisible by d, then replaces the number on the board with x - d. A player who cannot move loses.
Both play optimally. Return True if the first player wins, and False otherwise.start=4 → True
The first player subtracts 1, leaving 3. The second can only subtract 1, leaving 2. The first subtracts 1 again, leaving 1, and the second has no move.
start=1 → False
The number 1 has no suitable divisor, so the first player loses at once.
start=5 → False
start=4
True
Run checks the first 3 tests in your browser. Submit checks all 53 tests on the server, hidden ones included.