Walking on thin ice

Logic Level 5

Your friend decided to play a game with you. He asked you to pick an integer between 1 to 50 inclusive, let's say you pick the integer NN.

Now you are played against your friend such that both of you take turns subtracting a non-zero perfect square not larger than NN, the first person who cannot make the subtraction loses.

You're the first person to subtract first, then your friend, then you, and so on.

How many possible number are there for you to pick (from the start) such that you will always win the game?

Assume both of you intends to win the game and plays optimally.

Details and Assumptions:

  • As an explicit example, suppose you pick the number n=6n=6. Then you can subtract 4, the resultant number becomes 2. Your friend then subtract it by 1, leaving the number to be 1. And lastly, you are allowed to subtract it by 1 one more time. So your opponent can't make the subtraction anymore because the final number is 0. Thus he loses. This means that I can always win the game if I pick the integer 66.

Problem Loading...

Note Loading...

Set Loading...