Remove the Prime
Time limit6sMemory limit256 MB
Each move picks a prime p and a contiguous segment whose entries are all divisible by p, then strips every factor p from those entries; the player unable to move loses.
- Level
Medium7 of 10
- Topics
- Game theory, Number theory, Math
- Solved
- No attempts yet
Problem
Two players play a game using an array of positive integers. They make alternating moves, and the player who cannot make a move loses. In one move you have to choose a prime number and a non-empty segment of the array such that all numbers in this segment are divisible by , and then remove all factors from each of them. Removing all factors means that we take a number and divide it by while it is divisible.
Determine who wins if both players play optimally.
Input
The first line contains one integer (), the size of the array.
The second line contains the array itself ().
Output
Print "First" (without quotes) if the first player wins and "Second" (without quotes) otherwise.