Skip to main content
OlympiadHQ

Browse · MathNet

Print

11-th Czech-Slovak-Polish Match, 2011

2011 counting and probability

Problem

On the blackboard nonnegative integers have been written, such that their greatest common divisor is equal to . In one step we can erase two numbers , such that , and replace them with numbers , . Determine, for which sequences of original integers one can lead to a situation, in which numbers on the blackboard are zeroes.
Solution
The answer: the sum of the numbers has to be a power of , or they are all zeroes. From this moment we assume that the numbers are not all zeroes, otherwise we are done without making any step.

Let be the sum of the numbers on the blackboard and be their greatest common divisor at some moment. At the beginning is equal to , at the end it has to be equal to . We now prove that in each step, either stays the same or is multiplied by . Indeed, let be the numbers on the blackboard, without losing generality let the operation be performed on . Then we have that and is either or (multiplying one of the arguments by can multiply the greatest common divisor by if all the other arguments have more twos in their prime factorizations, or make it stay the same otherwise). As at the end must be equal to , has to be a power of two.

Now we prove that if is a power of two, then it is possible to obtain zeroes. Consider binary representations of all the numbers on the blackboard and write them one over another. Let be the index of the rightmost column that does not consist of only zeroes, i.e., is the smallest number such that not for all holds. If numbers are zeroes, then we are already done.

Otherwise, observe that in the -th column the number of ones has to be even (as is a power of , larger than ). Take such that they are not divisible by and perform the operation on them. Observe that after doing the operation all the columns with indices lower than still have only zeroes, however in the -th column the number of ones decrease by . Doing such operations we can delete ones from columns one after another, obtaining at the end the situation, in which we cannot apply the described rule. This means that numbers on the blackboard are zeroes.
Final answer
Exactly those initial sequences whose sum is a power of two (or the trivial case where all entries are zero).

Techniques

Invariants / monovariantsGreatest common divisors (gcd)