Skip to main content
OlympiadHQ

Browse · MathNet

Print

Japan Mathematical Olympiad

Japan counting and probability

Problem

Let be the number of cases such that each cell of a table is filled with one of , , or in such a way that any square in the table sums up to . Answer the remainder after dividing by .
Solution


For and , let denote the cell in the -th row and the -th column, and let denote the number filled in . We also define as

It is easy to check that and satisfies, for and , Indeed, since , if is even, and if is odd, On the other hand, if we assign for and in such a way that and satisfies (), satisfies the restriction of the original problem. Hence, equals to the number of cases of defining under the above condition.

Let and denote the maximum and the minimum of , respectively. Having (
) for every and is equivalent to the condition that is constant for for each . We denote this constant value by . Since for every is equivalent to and , or , for every , there are possibilities for assigning when are given.

.

In this case we have and there are only possibilities for . For each possibility, we have ways of assigning the rest of , thus the number of cases is .

.

In this case we have or . For each , we have possibilities for . Thus, the number of cases is .

* .

In this case we have possibilities for . Thus, the number of cases is .



To obtain the remainder after dividing by , we compute and . Since , we have . And since from Euler's totient theorem, This concludes that .
Final answer
3

Techniques

Coloring schemes, extremal argumentsFermat / Euler / Wilson theorems