how bob is winning???(NUMGAME 2)

can u explain me how BOB is winning when N=7;
accrding to me-

first chance:
bob would take out from N prime number 5…ie…(N-5)so new N is 2.
second chance:
alice would take out 1 and would certainly WIN…
plz help me out…

Here is detailed explanation to your NUMGAME2 problem.

Consider each value of N as a position. And positions have following properties:

  • All terminal positions are losing.

  • If a player is able to move to a losing position then he is in a winning position.

  • If a player is able to move only to the winning positions then he is in a losing position.

We will solve this problem from Bob’s point of view since he is the one to play first.

Now N = 1 (terminal position, property 1) is a
losing position for bob because he
has to play first and he can not
make a move. So N = 1 is losing position.

For N = 2, Bob can subtract 1 form N and manage to move to a losing position and since its now Alice’s chance and she is now at losing position Alice will loose and Bob will win (Property 2). So N = 2 is winning position.

Remember this is all from Bob’s point of view.

For N = 3, Bob can subtract 2 from N and get to losing position (i.e. N = 1) and wins the game.

For N = 4, subtract 3.

So far we have established that,

N   L/W
1    L
2    W
3    W
4    W

Consider N = 5, Bob can subtract {1, 2, 3} from the N

Subtract 1, N = 4 Winning position
Subtract 2, N = 3 Winning position
Subtract 3, N = 2 Winning position

So Bob is not able to move to a losing position, and there by he loses (property 3).

Hence N = 5 is a losing position.

If we go on like this we will see that positions {1, 5, 9, 13, 17…} are losing position for Bob. That is N = {4 * x + 1, x = 0, 1, 3,…}.

Therefore for N = 7 Bob wins. He can subtract 3 and manage to move to a losing position. And by property 2 he wins the game.

Hope it helps, Best Luck :slight_smile:

And Please Do Not Spam the forum with repeated questions.

got it thnx…:slight_smile:

7-3 = 4 is a winning position for alice,then how BOB wins??please answer.

@abhi_sarkar96 As both players are playing optimally so BOB will subtract 2 not 3.