Several positive integers are written in a row. Iteratively, Alice chooses two adjacent numbers and such that and is to the left of , and replaces the pair by either or . Prove that she can perform only finitely many such iterations.
Solutions — 3
Solution 1
Note first that the allowed operation does not change the maximum of the initial sequence. Let be the numbers obtained at some point of the process. Consider the sum
We claim that increases by a positive integer amount with every operation. Let the operation replace the pair by a pair , where and or . Then the new and the old value of differ by
The integer is positive since and .
On the other hand as for all . Since increases by at least 1 at each step and never exceeds the constant , the process stops after a finite number of iterations.
Solution 2
Like in the first solution, note that the operations do not change the maximum of the initial sequence. Now consider the reverse lexicographical order for -tuples of integers. We say that if , or if and , or if , and , etc. Each iteration creates a sequence that is greater than the previous one with respect to this order, and no sequence occurs twice during the process. On the other hand, there are finitely many possible sequences because their terms are always positive integers not exceeding . Hence the process cannot continue forever.
Solution 3
Let the current numbers be . Define the score of as the number of 's that are less than . Call the sequence the score sequence of .
Let us say that a sequence dominates a sequence if the first index with is such that . We show that after each operation the new score sequence dominates the old one. Score sequences do not repeat, and there are finitely many possibilities for them, no more than . Hence the process will terminate.
Consider an operation that replaces by , with or . Suppose that was originally at position . For each the score does not increase with the change because and . If decreases for some then the new score sequence dominates the old one. Assume that stays the same for all and consider . Since and , we see that decreases by at least 1. This concludes the proof.