A pile of chips involving primes

Ann and Bob play alternately on a pile of chips. On each play, either 1, 2 or 3 chips can be removed except if the number of chips is a prime number. In that case either 1, 2, 3, 4 or 5 chips can be removed.The person, who removes the last chip is the winner. There are 100 chips on the pile. Ann starts. Determine a winning strategy for one of the players.

• It could work without a trivial answer if primes didn't allow all the moves for compounds. Jul 24, 2019 at 15:19

It seems like you force a win if you can leave behind a multiple of 4. So the first player is guaranteed to lose because he cannot leave behind a multiple of 4. Whatever amount player 1 takes (x), player 2 should take 4 - x.

Here's a little Python program to test it yourself:

https://repl.it/repls/ScientificIdenticalPixels

And here's C++ code written by user @im_so_meta_even_this_acronym

https://ideone.com/SfMHqC

• Would you mind adding my code for C++ users? :) ideone.com/SfMHqC Jul 23, 2019 at 22:28