Variation of nim game

44 Views Asked by At

Two players take turns taking an integer from [2, 30]. When a player takes a number that has a common factor with a number previously taken, that players loses. Would you prefer to go first or second, and what is your optimal strategy?

My initial thought: I first considered how many prime numbers there are within this interval (10). Once all the prime numbers have been said, any number taken after that will result in that players loss. So my strategy revolves around ensuring you are the player who gets to take away the last prime. To me, this implies forcing the other player to take a prime number first, and then any time he takes a prime you take a prime as well to keep the number of primes even. But how can you force the other player to take the first prime?