Skip to main content
OlympiadHQ

Browse · MathNet

Print

Belarusian Mathematical Olympiad

Belarus counting and probability

Problem

Ann and Bob play the following game. They, in turn (Ann starts), replace one of the asterisks in the expression by one of the digits from to (each digit can be used exactly one time). Ann wins if the obtained -digit number is divisible by , otherwise Bob wins. Who of the players wins if both of them play to win?
Solution
Answer: Bob wins.

It is well-known that a natural number is divisible by if and only if , where are the sums of the digits on the odd and even positions respectively in the decimal representation of .

Let Ann use the numbers , , and for her first, second, and third moves respectively; let Bob use the numbers and for his first and second moves respectively.

The following cases are possible after two Ann's moves and one Bob's move:

1. and occupy two odd positions, occupies the even position of the asterisks; 2. and occupy two even positions, occupies the odd position of the asterisks (different from the first position); 3. and occupy one even and one odd positions, occupies the even position of the asterisks.

Let be the set of unused digits before the second Bob's move.

In the first case Bob replaces the asterisk on the even position by . Then , . Let . Now the congruence is equivalent to the congruence .

If , then can use any digit from the set as the number because the congruence is impossible if and are the distinct digits.

Let . Suppose that for any digit there exists a digit , such that , . Summing these seven congruences we obtain Since it is evident that , we see that the obtained congruence is equivalent to the congruence , which is impossible since . Therefore, there exists a number such that for any digit different from . So Bob can use this number for his second move to win.

Consider two other cases. In these cases Bob replaces the asterisk on the odd position (different from the first one) by . Then we have for the second case, and or for the third one.

Set in (1), in (2), and in (3).

Therefore, the congruence is equivalent to the congruence for all cases. Suppose that for any digit there exists a digit such that , , . It follows that all digits from are partitioned into the pairs of distinct digits with the sum which is congruent to modulo , but it is impossible since the number of digits in is odd. Therefore, there exists a number such that for any digit different from . So Bob can use this number for his second move to win.
Final answer
Bob wins

Techniques

Games / greedy algorithmsInvariants / monovariantsOther