The rules of the game are located in the attached image. Just to see what this game looks like, I'll run a quick easy example.
N=10. P1 must choose a divisor, d, of 10 (other than itself). P1 chooses 5. The difference of N and d is P2's new position.
N-d = 10-5 = 5
So 5 is P2's new position. P2 is forced to choose d=1 since 5 is prime, giving P1 a position of 4. 4 is what is called a "winning position", because if the player in this position plays ideally, he/she can always win.
P1 must choose a divisor of 4, and his choices are 1 and 2. All P1 needs to do to win is choose 1, which gives P2 a position of 3.
P2 is forced to choose 1 because 3 is prime, and P1 will win the game because he will make P2's score 1 in the end (2-1=1).
What is the ideal strategy for this game? How does your strategy depend on N?