Interesting problem. I believe the answer is 250,500.
Let's solve a different problem, where instead of removing the GCD from each pile in the pair, you only remove 1 coin.
Let's start by pairing pile 1001 with each of the other 1000 piles, so 1000 operations. We remove one coin from each pile.
We have now exhausted pile 1, and pile 1001 can no longer be paired, so we are left with 999 piles having quantity 1, 2, ... and 999.
Now pair pile 1000 (whose qty is now 999) with the other 998 piles, so 998 operations.
Perform this process for a total of 499 times, at which point piles 1-499 are empty, pile 500 has qty 1, pile 501 has qty 2, pile 502 has quantity 3, and piles 503-1001 can no longer be paired.
There have been 1000 + 998 + ... + 2 = 250,500 operations. In general, for 2k+1 piles, there will have been k*(k+1) operations. This is clearly an upper limit for the problem answer,
Now, for some hand-waving.
The same 250,500 pile pairings could have been done in any order. I might be wrong, but I assert without proof that the order of pairings can be arranged so that the number of stones in the two paired piles are always relatively prime before the pairing. In which case, the puzzle answer is also 250,500.
Can anybody prove me wrong?
Edited on May 17, 2025, 4:02 pm