Empty and Divide

There are two boxes. Initially, one box contains m m chips and the other contains n n chips. Such a position is denoted by ( m , n ) (m,n) , where m > 0 m>0 and n > 0 n>0 . Two players alternate moving. A move consists of emptying a box and equally divide the contents of the other between the two boxes with at least one chip in each box. Given that both players play optimally, how many starting positions ( m , n ) (m,n) , 1 < m , n < 1 , 000 1<m,n<1,000 are there such that the first player can win?

Explicit Examples

  • ( 1 , 1 ) (1,1) is a losing starting position. The first player cannot make any moves as it will leave one of the box empty after dividing.

  • ( 3 , 2 ) (3,2) is a winning starting position. The first player empties the first box and leaves a position ( 1 , 1 ) (1,1) to the second player. Since no available moves exist for the second player, the first player wins by default.

Clarifications

  • "equally divide the contents" means that the difference after the division must not be more than 1.


The answer is 159999.

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.

0 solutions

No explanations have been posted yet. Check back later!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...