Beat your Friend at Subtraction!

You and your friend are playing a game. The game goes as follows:

  • At the start, you are given a positive integer N N .
  • You choose a positive factor n n of N N , where n N n \neq N .
  • You compute N n N - n and give the result to your friend.
  • Your friend repeats the above procedure with the integer she is given and gives the result to you, and so forth.

For example, if you are given N = 12 , N = 12, you can choose n = 3 n = 3 and give N n = 9 N - n = 9 to your friend. Then, N = 9 N = 9 .

Play continues in this fashion until one person is given N = 1 N = 1 , at which point that person loses.

Given that you and your friend will both play optimally, how many positive integers N 2015 N \leq 2015 are there such that, when given at the start, you will always win?

Problem source: ASMT 2015 Team #3


The answer is 1007.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Steven Yuan
Feb 15, 2015

You should get an even integer in the beginning. Then, your strategy is to subtract 1 1 from all the integers you are given. (You can do this because 1 1 is a factor of every positive integer, except perhaps 1 1 .) In this way, you will always give your friend odd integers, and your friend can only give you even integers, regardless of how your friend subtracts. This is because odd integers have only odd factors e.g. 15 15 has proper factors 1 , 3 1, 3 and 5 5 . Since subtracting an odd from an odd yields an even, your friend is forced to give you even numbers.

Eventually, you will reach a point where you get the integer 2 2 , and you give 2 1 = 1 2 - 1 = 1 to your friend. You win the game. On the other hand, your friend can never win because 1 1 is odd, and she can only produce even integers. (Conversely, if you are given an odd integer, then your friend can utilize the strategy to win, so you'll always lose.)

Thus, our solution is the number of even integers between 1 1 and 2015 2015 . This is 1007 \boxed{1007} .

just brilliant!!!

Adarsh Kumar - 6 years, 3 months ago

Very nice solution !

Akshat Sharda - 5 years, 3 months ago

I solved a question like this at the AMOC School of Excellence.

Sharky Kesa - 6 years, 3 months ago

did the same.

sanyam khankhoje - 6 years, 3 months ago
Stewart Gordon
Jul 29, 2015

The winning positions for the player who has the move are exactly the even integers.

Proof by complete induction:

Base step: N = 1 N = 1

  • By the rules of the game, this is losing.

Inductive step: Assume true for N < K N < K . For N = K N = K :

  • If K K is even:

    • Player can subtract 1. By the induction hypothesis, K 1 K - 1 is losing, therefore K K is winning.
  • If K K is odd:

    • Player can subtract only an odd number L L . The result will be a smaller even number K L K - L . By the induction hypothesis, K L K - L is winning for all available L L , therefore K K is losing.

There are 1007 \boxed{1007} even integers in [ 1 , 2015 ] [1, 2015] , therefore this is the number of winning positions.

Peter Byers
Oct 10, 2015

Anyone care to try a variation? Everything is the same as the original question, except the loser is the first person to cause the number to drop below 6.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...