There are several positive integers arranged in a row. A person each time selects two adjacent numbers and , where , and is to the left of ; then he replaces this pair with or . Then he repeats such choosing and replacing operations. Prove that he can only perform finitely many such operations.
Solution
Solution 1 Note that the operation in the problem does not change the maximum value of the original sequence. Let the sequence obtained after some operation be . Consider the following sum
We claim: after each operation, always increases by some positive integer amount. Suppose some operation replaces the pair with , where , and is either or . Then the difference between the new value and the old value of is
Since , and , must be a positive integer.
On the other hand, since each , we get . Since increases by at least 1 after each operation, and never exceeds the fixed value , the operation must terminate after finitely many steps.
Solution 2 As in Solution 1, note that the maximum value of the sequence never changes. Now consider the reverse lexicographic order on sequences of positive integers: we write when , or when holds for all but . Under this order, every operation makes the sequence larger, and throughout the process the same sequence never appears twice.
On the other hand, since each term is a positive integer with a fixed maximum value, there are only finitely many possible sequences. Therefore this operation cannot proceed indefinitely.
Solution 3 Suppose the current sequence is . Let denote the number of terms in this sequence that are less than . Call the sequence the score sequence of the sequence .
For two sequences and , if at the index with the largest value such that we have , we say the sequence beats the sequence . We claim: after each operation, the new score sequence will beat the original score sequence. Once this property is proven, since the score sequence never repeats, and there are only finitely many possible score sequences, the operation must terminate after finitely many steps.
Consider the operation that changes into , where or . Suppose originally appeared at the -th position. For every , does not increase after the operation, because and . If for some , decreases, then the new score sequence beats the original score sequence. If for every , remains unchanged, look at : since and , we get that decreases by at least 1. This completes the proof.