The Game of Subtracting Primes
Computer Science
Level
3
Ivan and Jake are playing a game with the following rules:
 The game starts with a parameter N which is a positive integer.
 Ivan always plays first.
 In each turn, the player can either choose to add or subtract the largest prime smaller than N, to N.
 The loser is the person who cannot continue. The other person wins by default.
Example
1 2 3 4 5 6 

Now, suppose that Ivan and Jake know how to play optimally. For how many starting values of \(N < 10^4\) does Jake win?