Maths Olympiad Prep

Track / Stage 10 / 21 of 32 #2593 of 2604

Problem 2593

Hardest shortlist tier
Number theory Difficulty 9.3 Prove it IMO Shortlist · IMO · 2021

Determine all integers n⩾2n \geqslant 2 with the following property: every nn pairwise distinct integers whose sum is not divisible by nn can be arranged in some order a1,a2,…,ana_{1}, a_{2}, \ldots, a_{n} so that nn divides 1⋅a1+2⋅a2+⋯+n⋅an1 \cdot a_{1}+2 \cdot a_{2}+\cdots+n \cdot a_{n}.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Next problem →

Official solution

Answer: All odd integers and all powers of 22.

If n=2kan=2^{k} a, where a⩾3a \geqslant 3 is odd and kk is a positive integer, we can consider a set containing the number 2k+12^{k}+1 and n−1n-1 numbers congruent to 11 modulo nn. The sum of these numbers is congruent to 2k2^{k} modulo nn and therefore is not divisible by nn; for any permutation (a1,a2,…,an)\left(a_{1}, a_{2}, \ldots, a_{n}\right) of these numbers
1⋅a1+2⋅a2+⋯+n⋅an≡1+⋯+n≡2k−1a(2ka+1)≢0( mod 2k) 1 \cdot a_{1}+2 \cdot a_{2}+\cdots+n \cdot a_{n} \equiv 1+\cdots+n \equiv 2^{k-1} a\left(2^{k} a+1\right) \not \equiv 0 \quad\left(\bmod 2^{k}\right)
and a fortiori 1⋅a1+2⋅a2+⋯+n⋅an1 \cdot a_{1}+2 \cdot a_{2}+\cdots+n \cdot a_{n} is not divisible by nn.

From now on, we suppose that nn is either odd or a power of 22. Let SS be the given set of integers, and ss be the sum of elements of SS.

Lemma 1. If there is a permutation (ai)\left(a_{i}\right) of SS such that (n,s)(n, s) divides ∑i=1niai\sum_{i=1}^{n} i a_{i}, then there is a permutation (bi)\left(b_{i}\right) of SS such that nn divides ∑i=1nibi\sum_{i=1}^{n} i b_{i}.

Proof. Let r=∑i=1niair=\sum_{i=1}^{n} i a_{i}. Consider the permutation (bi)\left(b_{i}\right) defined by bi=ai+xb_{i}=a_{i+x}, where aj+n=aja_{j+n}=a_{j}. For this permutation, we have
∑i=1nibi=∑i=1niai+x≡∑i=1n(i−x)ai≡r−sx( mod n) \sum_{i=1}^{n} i b_{i}=\sum_{i=1}^{n} i a_{i+x} \equiv \sum_{i=1}^{n}(i-x) a_{i} \equiv r-s x \quad(\bmod n)
Since (n,s)(n, s) divides rr, the congruence r−sx≡0( mod n)r-s x \equiv 0(\bmod n) admits a solution.

Lemma 2. Every set TT of kmk m integers, m>1m>1, can be partitioned into mm sets of kk integers so that in every set either the sum of elements is not divisible by kk or all the elements leave the same remainder upon division by kk.

Proof. The base case, m=2m=2. If TT contains kk elements leaving the same remainder upon division by kk, we form one subset AA of these elements; the remaining elements form a subset BB. If kk does not divide the sum of all elements of BB, we are done. Otherwise it is enough to exchange any element of AA with any element of BB not congruent to it modulo kk, thus making sums of both AA and BB not divisible by kk. This cannot be done only when all the elements of TT are congruent modulo kk; in this case any partition will do.

If no kk elements of TT have the same residue modulo kk, there are three elements a,b,c∈Ta, b, c \in T leaving pairwise distinct remainders upon division by kk. Let tt be the sum of elements of TT. It suffices to find A⊂TA \subset T such that ∣A∣=k|A|=k and ∑x∈Ax≢0,t( mod k)\sum_{x \in A} x \not \equiv 0, t(\bmod k): then neither the sum of elements of AA nor the sum of elements of B=T\AB=T \backslash A is divisible by kk. Consider U′⊂T\{a,b,c}U^{\prime} \subset T \backslash\{a, b, c\} with ∣U′∣=k−1\left|U^{\prime}\right|=k-1. The sums of elements of three sets U′∪{a},U′∪{b},U′∪{c}U^{\prime} \cup\{a\}, U^{\prime} \cup\{b\}, U^{\prime} \cup\{c\} leave three different remainders upon division by kk, and at least one of them is not congruent either to 00 or to tt.

Now let m>2m>2. If TT contains kk elements leaving the same remainder upon division by kk, we form one subset AA of these elements and apply the inductive hypothesis to the remaining k(m−1)k(m-1) elements. Otherwise, we choose any U⊂T,∣U∣=k−1U \subset T,|U|=k-1. Since all the remaining elements cannot be congruent modulo kk, there is a∈T\Ua \in T \backslash U such that a≢−∑x∈Ux( mod k)a \not \equiv-\sum_{x \in U} x(\bmod k). Now we can take A=U∪{a}A=U \cup\{a\} and apply the inductive hypothesis to T\AT \backslash A.

Now we are ready to prove the statement of the problem for all odd nn and n=2kn=2^{k}. The proof is by induction.

If nn is prime, the statement follows immediately from Lemma 1, since in this case (n,s)=1(n, s)=1. Turning to the general case, we can find prime pp and an integer tt such that pt∣np^{t} \mid n and pt∤sp^{t} \nmid s. By Lemma 2, we can partition SS into pp sets of np=k\frac{n}{p}=k elements so that in every set either the sum of numbers is not divisible by kk or all numbers have the same residue modulo kk.

For sets in the first category, by the inductive hypothesis there is a permutation (ai)\left(a_{i}\right) such that k∣∑i=1kiaik \mid \sum_{i=1}^{k} i a_{i}.

If nn (and therefore kk) is odd, then for each permutation (bi)\left(b_{i}\right) of a set in the second category we have
∑i=1kibi≡b1k(k+1)2≡0( mod k) \sum_{i=1}^{k} i b_{i} \equiv b_{1} \frac{k(k+1)}{2} \equiv 0 \quad(\bmod k)
By combining such permutation for all sets of the partition, we get a permutation (ci)\left(c_{i}\right) of SS such that k∣∑i=1nicik \mid \sum_{i=1}^{n} i c_{i}. Since this sum is divisible by kk, and kk is divisible by (n,s)(n, s), we are done by Lemma 1.

If n=2sn=2^{s}, we have p=2p=2 and k=2s−1k=2^{s-1}. Then for each of the subsets there is a permutation (a1,…,ak)\left(a_{1}, \ldots, a_{k}\right) such that ∑i=1kiai\sum_{i=1}^{k} i a_{i} is divisible by 2s−2=k22^{s-2}=\frac{k}{2}: if the subset belongs to the first category, the expression is divisible even by kk, and if it belongs to the second one,
∑i=1kiai≡a1k(k+1)2≡0( mod k2) \sum_{i=1}^{k} i a_{i} \equiv a_{1} \frac{k(k+1)}{2} \equiv 0\left(\bmod \frac{k}{2}\right)
Now the numbers of each permutation should be multiplied by all the odd or all the even numbers not exceeding nn in increasing order so that the resulting sums are divisible by kk:
∑i=1k(2i−1)ai≡∑i=1k2iai≡2∑i=1kiai≡0( mod k) \sum_{i=1}^{k}(2 i-1) a_{i} \equiv \sum_{i=1}^{k} 2 i a_{i} \equiv 2 \sum_{i=1}^{k} i a_{i} \equiv 0 \quad(\bmod k)
Combining these two sums, we again get a permutation (ci)\left(c_{i}\right) of SS such that k∣∑i=1nicik \mid \sum_{i=1}^{n} i c_{i}, and finish the case by applying Lemma 1.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty, ordering) added by this project.