Daily

Random

Practice set

Baltic Way 2020 · Problem 16

Number Theory

Richard and Kaarel are taking turns to choose numbers from the set {1,…,p−1}\{1, \ldots, p-1\} where p>3p>3 is a prime. Richard is the first one to choose. A number which has been chosen by one of the players cannot be chosen again by either of the players. Every number chosen by Richard is multiplied with the next number chosen by Kaarel. Kaarel wins the game if at any moment after his turn the sum of all of the products calculated so far is divisible by pp. Richard wins if this does not happen, i.e. the players run out of numbers before any of the sums is divisible by pp. Can either of the players guarantee their victory regardless of their opponent's moves and if so, which one?

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

GCD and LCM · Divisibility and factorization · Modular arithmetic

Solutions

Solution

Answer: Yes, Kaarel.

Let us split the numbers in the set to the following pairs: (1,p−1)(1, p-1), (2,p−2)(2, p-2), …\dots, (p−12,p+12)\left(\frac{p-1}{2}, \frac{p+1}{2}\right). If Richard chooses some number aa, then let Kaarel choose the other number from the pair i.e. p−ap-a. This forces Richard to choose a number from a pair in which both of the numbers have not been chosen yet and hence Kaarel can make his desired move. The residues modulo pp of the products are of the form −a2-a^2. The residue of the sum of all the products is congruent to −(12+22+⋯+(p−12)2)-(1^2 + 2^2 + \dots + (\frac{p-1}{2})^2). For every natural number nn, we have 12+22+⋯+n2=n(n+1)(2n+1)61^2 + 2^2 + \dots + n^2 = \frac{n(n+1)(2n+1)}{6}, therefore 12+22+⋯+(p−12)2=(p−1)p(p+1)241^2 + 2^2 + \dots + (\frac{p-1}{2})^2 = \frac{(p-1)p(p+1)}{24}. This must be an integer and as pp and 2424 are coprime, (p−1)p(p+1)24\frac{(p-1)p(p+1)}{24} must be divisible by pp. Therefore, when the last number is chosen from the set, the sum of the products is divisible by pp.

Contest context

Results from Baltic Way 2020

10 teams

Mean score
4.3 / 5
Scores of 4 or 5
9 / 10
Estonia
5 / 5

Score distribution

01
10
20
30
42
57
All team scores
TeamScore
Germany5 / 5
Norway5 / 5
Poland5 / 5
Finland5 / 5
Latvia5 / 5
Estonia5 / 5
Denmark4 / 5
Sweden5 / 5
Lithuania4 / 5
Iceland0 / 5