Skip to main content
OlympiadHQ

Browse · MathNet

Print

51st IMO Shortlisted Problems

counting and probability

Problem

The rows and columns of a table are numbered from to . The cells of the table have been colored with the following property being satisfied: for each , the th cell in the th row and the th cell in the th row have the same color. (The indices of the cells in a row are considered modulo .)

Prove that the maximal possible number of colors is .

(Iran)
Solution
Throughout the solution we denote the cells of the table by coordinate pairs; refers to the th cell in the th row.

Consider the directed graph, whose vertices are the cells of the board, and the edges are the arrows for all . From each vertex , exactly one edge passes (to ); conversely, to each cell exactly one edge is directed (from the cell ). Hence, the graph splits into cycles.

Now, in any coloring considered, the vertices of each cycle should have the same color by the problem condition. On the other hand, if each cycle has its own color, the obtained coloring obviously satisfies the problem conditions. Thus, the maximal possible number of colors is the same as the number of cycles, and we have to prove that this number is .

Next, consider any cycle ; we will describe it in other terms. Define a sequence by the relations for all (we say that such a sequence is a Fibonacci-type sequence). Then an obvious induction shows that . Hence we need to investigate the behavior of Fibonacci-type sequences modulo .

Denote by the Fibonacci numbers defined by , and for . We also set according to the recurrence relation.

For every positive integer , denote by the exponent of in the prime factorization of , i.e. for which but .

Lemma 1. For every Fibonacci-type sequence , and every , we have .

Proof. Apply induction on . The base cases are trivial. For the step, from the induction hypothesis we get

Lemma 2. For every , (a) we have ; (b) is the least positive index for which ; (c) .

Proof. Apply induction on . In the base case we have , so , the preceding Fibonacci-numbers are not divisible by , and indeed .

Now suppose that and let . By applying Lemma 1 to the Fibonacci-type sequence we get By the induction hypothesis, , and is odd. Therefore we get , which implies , establishing statement (a).

Moreover, since for some integer , we get as desired in statement (c).

We are left to prove that for . Assume the contrary. Since , from the induction hypothesis it follows that . But then we have , where the second summand is divisible by but the first one is not (since is odd and ). Hence the sum is not divisible even by . A contradiction.

Now, for every pair of integers , let . By an obvious induction, for every Fibonacci-type sequence we have ; denote this common value by . Also denote by the period of this sequence modulo , that is, the least such that for all .

Lemma 3. Let be a Fibonacci-type sequence such that . Then .

Proof. First, we note that the sequence has period modulo if and only if the sequence has period modulo . Hence, passing to this sequence we can assume that .

We prove the statement by induction on . It is easy to see that for the claim is true; actually, each Fibonacci-type sequence with behaves as modulo , and as modulo (all pairs of residues from which at least one is odd appear as a pair of consecutive terms in this sequence).

Now suppose that and consider an arbitrary Fibonacci-type sequence with . Obviously we should have , or, using the induction hypothesis, . Next, we may suppose that is even; hence is odd, and , for some integers .

Consider the Fibonacci-type sequence starting with . Since , by an easy induction we get for all . By the induction hypothesis, we have , hence the sequence is -periodic modulo . On the other hand, by Lemma 2 we have , hence The first line means that is not -periodic, while the other two provide that , and hence for all . Hence and , which means that , as desired.

Finally, Lemma 3 provides a straightforward method of counting the number of cycles. Actually, take any number and consider all the cells with . The total number of such cells is . On the other hand, they are split into cycles, and by Lemma 3 the length of each cycle is . Hence the number of cycles consisting of these cells is exactly . Finally, there is only one cell which is not mentioned in the previous computation, and it forms a separate cycle. So the total number of cycles is

Techniques

Graph TheoryColoring schemes, extremal argumentsInvariants / monovariantsRecurrence relationsModular ArithmeticDivisibility / Factorization