Problem

Source:

Tags: algebra, combinatorics, game strategy, game



Two pirates divide the loot, consisting of two bags of coins and a diamond, according to the following rules. First the first pirate takes take a few coins from any bag and transfer them from this bag in the other the same number of coins. Then the second pirate does the same (choosing the bag from which he takes the coins at his discretion) and etc. until you can take coins according to these rules. The pirate who takes the coins last gets the diamond. Who will get the diamond if is each of the pirates trying to get it? Give your answer depending on the initial number of coins in the bags.