A natural number n represents the initial position in the game. When it is a players turn he/she is allowed to
I) Subtract 2 from n II) Subtract 3 from n III) Subtract 5 from n
We call the player who begin the game Adam and the other player Berta. The players alternate by applying on of the three rules to the number 0 or a negative number his/her opponent. If a player manages to produce the number 0 or a negative number he/she wins the game.
Here is an example of a game played by Adam and Berta (for n=15)
15 is given to Adam. He decides to subtract 5 leaving 15-5 = 10 to Berta 10 is given to Berta. She decides to subtract 3 leaving 11-3=8 to Beta 8 is given to Adam. He decides to subtract 2 leaving 8-2=6 to Berta 6 is given to Berta. She decides to subtract 2 leaving 6-2=4 to Adam 4 is given to Adam. He decides to subtract 5 producing -1 a negative number, Adam wins!
b) we define a one dimensional array X(1), X(2),X(3),..,X(n)
i) X(j) =1 if Adam has a method to win when given the number j ii) X(j)=0 if Adam has no method that guarantees that he wins when the given the number k
What is X(8), X(13) and X(24)? Answer should be of the form boolean boolean boolean so if X(8)=0 , X(13)=1 and X(24)=1 the correct answer is 011 Thus the correct answer is one of the following 000 001 010 011 100 101 110 111
My attempt is
n=8 Adam: 8-5=3 Berta: 3-3 =0 Berta wins 0 n=13 Adam=13-5=8 Berta: 8-3=5 Adam 5- 5 Adam wins 1 I get really stuck with 24, so far I have 01
Is there a method for this type of problem, i have been stuck on it for ages now. Thanks in advance