Solution to March 2002 Problem

Your enemy gets to choose 2000 of the counting numbers from 1 to 3000. Your job is to find a subsequence of 1000 of your enemy's numbers so that they alternate odd, even, odd, even, ... when listed in their natural order. Prove that no matter how clever your enemy might be, you can always succeed.

We thank Aart Blokhuis of Eindhoven University of Technology for March's problem. He devised it for the past year's Dutch Mathematical Olympiad. Five correct solutions were submitted this month:

Francesco Barioli (Regina)
Juan Mir Pieras (Spain)
Penny Nom (Regina)
Alexander Potapenko (Russia)
Gordon Turpin (Toronto)

Two of these were clever and quite similar, but the others were each clever and quite different from one another. It is interesting to look at all four solutions and see what they have in common.

Solution 1. Submitted independently by Francesco Barioli and Juan Mir Pieras.

Consider the 1500 pairs of numbers (1, 2), (3, 4), (5, 6), ..., (2999, 3000). In choosing 2000 numbers, our enemy has eliminated the other 1000 numbers. That means that at most 1000 of the pairs could contain one (or two) of those missing numbers. We are therefore left with at least 500 complete pairs - that is, number pairs whose entries were both chosen by the enemy. We simply take five hundred of those complete pairs for our sequence of 1000 numbers ordered odd, even, odd, even, ... .

Solution 2. Submitted by Gordon Turpin.

Consider the sequence of numbers chosen by the adversary in their natural order. The entire sequence would exhibit odd-even alternation if it were not for intervening sequences of missing numbers (numbers not chosen). Of these contiguous sequences of missing numbers, we note that

only odd-length sequences can interrupt the odd-even alteration of chosen numbers.

Justification: if a number n is followed by an even number (say 2k) of missing numbers, then the next chosen number will be n + 2k + 1, which will have different parity, thus preserving the odd-even alteration. A similar argument shows that odd-length missing sequences do interrupt the odd-even alteration.

We choose our subsequence of the adversary's sequence as follows: remove the chosen number immediately following each odd-length sequence of missing numbers. This turns all odd-length missing number sequences into even-length missing number sequences and costs us one chosen number per odd-length to even-length conversion. The shortest odd-length missing number sequence is of length 1. There are 1000 missing numbers in all, so at most 1000 odd-length sequences. Changing all odd-length missing sequences to even-length will thus cause the removal of at most 1000 numbers from the sequence of 2000 chosen by the adversary.

We are left with at least 1000 number in odd-even alternation.

Solution 3. Submitted by Alexander Potapenko.

We again look at the holes in the sequence chosen by the enemy, but in a different way: The sequence is x1, x2, ..., x2000, and we put
y1 = x1 - 0, y2 = x2 - x1, y3 = x3 - x2, ..., y2000 = x2000 - x1999. Then for each n we have

xn = y1 + y2 + ... + yn. So, if the odd numbers in the y-sequence are yn1, yn2, ..., yna, then xn1, xn2, ..., xna is a sequence alternating between odd and even numbers; it suffices to show that a >= 1000.

For this purpose, we define Yodd to be the average of all odd numbers in the y-sequence, and Yeven to be the average of all even numbers in the y-sequence. Of course, if the y-sequence does not contain any even numbers, then Yeven does not exist, but then a = 2000 and we are done.

Otherwise we have Yeven >= 2. And since y1 + y2 + ... + y2000 = x2000 <= 3000, the average of all numbers in the y-sequence is at most  3/2, therefore Yodd <=  3/2. In particular this shows Yodd < Yeven. From the inequality a Yodd + (2000-a)Yeven <= 3000, we then get

Solution 4. Submitted by Penny Nom.

Penny gave us a variation of Alexander's argument, showing that in fact, at least 999 of the differences y2, y3, ..., y2000 are equal to 1:
We have

y2 + y3 + ... + y2000 = x2000 - x1 <= 2999. If k of y2, y3, ..., y2000 are equal to 1 and the other 1999 - k are at least 2, then the left-hand term is at least k + 2 ... (1999 - k), so the above inequality gives k + 2 ... (1999 - k) <= 2999; that is, k >= 999.

The rest of her argument goes as follows: Consider a longest subsequence a1, a2, ..., ap alternating between odd and even numbers. Then the terms xi that come before a1 must all have the same parity as a1, so that xi+1 - xi is at least 2. Similarly, the terms xi that come after ap all have the same parity as ap, so that xi - xi-1 is at least 2. From aj to aj+1, the terms xi can switch parity only once (otherwise it would be possible to enlarge our subsequence), so there is at most one term xi - xi-1 equal to 1. Therefore, p - 1 is at least 999, so p is at least 1000.

Note that the sequence constructed with Penny's argument may start with an even number. One slight modification in the argument would be needed to show that there is a 1000-term alternating subsequence starting with an odd number. (Can you find this modification?) On the other hand, combining Penny's solution with the previous solutions, we find that if the longest alternating subsequence starts with an even number, then it contains at least 1001 terms.