A game consists of two players and one pile with n beans. In each move, a player can take P^k beans.( P is a prime number and k is an integer. P and k are not fixed. ) The winner is the player who does the last move.
Determine which player has a winning strategy based on n.
I tried using the binary table and the xor function often explained in the standard game where you can take any amount of beans in each move but I can't quite figure out how to apply that solution properly here.
This question came up during my discrete math class during the Game Theory presentation and we are to search for the answer. I would appreciate some help.