bill's blog

Writeup: IMO Shortlist 2001 C5

Problem Statement:

Find all finite sequences (x0,x1,,xn) such that for every j, 0jn, xj equals the number of times j appears in the sequence.

My Solution:

After attempting A2 today and failing miserably, this problem made me feel better about myself. I felt like this was more of a logic puzzle than anything else.

The first thing I noticed was that x00, otherwise we would have a contradiction, and that xi=n+1. I also noticed that giving positive values for xi where i is a large number "spawns" in a lot of numbers, which could break the summation constraint I just mentioned above.

The key observation to solving this problem is that

i=1nxi=p,

where p is the number of nonnegative terms in the sequence.

Now note that we must have 0 be positive, and there are p1 positive terms from i=1 to n. So all the other terms must be 0, 1, or 2. Note that we can only have x0 be a value greater than 2. So the values we have to inspect are x0,x1,x2, and xx0. Note that, if x0=1, then the only sequence that satisfies will be (1,2,1,0). If x0=2, then the only sequence that satisfies these constraints will be (2,1,2,0,0), (2,0,2,0). If x0>3, then we have the sequence (x0,2,1,0,,0,1,0,0,,0), since we must have xx0=1 (if it was 2, then we would have another non-1 and non-2 value with value x0 somewhere else), and we can't have x1=1 otherwise we would have 2 1's, so we must have x2=1, and therefore we must have x1=2. These are the only solutions so we're done.