The Divisor Game
Starting with N, players alternate replacing N with N − d where d is any proper divisor of N (1 ≤ d < N). A player who cannot move (N = 1) loses. Who wins?
Input: one integer N.
Output: FIRST or SECOND.
Constraints:
- 1 ≤ N ≤ 1018
Sample Tests
Input 1
2
Output 1
FIRST
Input 2
3
Output 2
SECOND
Discussion (opens after you solve — no spoilers before)
No comments yet.