Olympiad Maths Prep

Track / Stage 9 / 65 of 80 #1945 of 2000

Problem 1945

IMO P2/P5; hard shortlist
Number theory Difficulty 9.1 Prove it 2023 Chinese IMO National Team Selection Test · China · 2023

Given an integer n>1n > 1 and an integer aa that is coprime with nn. There is a country consisting of nn islands D1,D2,,DnD_1, D_2, \dots, D_n. For any two different islands DiD_i and DjD_j, there is a one-way ferry from DiD_i to DjD_j if and only if ijia(modn)ij \equiv ia \pmod{n}. A tourist hopes to visit as many islands as possible. He can first fly to any island he chooses to start the tour, and afterwards can only use the one-way ferry to tour freely between islands in this country. Find the maximum possible number of different islands that the tourist can visit.

This one wants a proof. Work it on paper, read the official solution, then mark yourself honestly — the ladder only means something if the record is true.

Official solution

Let x(n)=vp(n)21x(n) = \sum_{v_p(n) \ge 2} 1 and y(n)=vp(n)=11y(n) = \sum_{v_p(n)=1} 1. Let the maximum number of islands that can be visited be denoted as k(n)k(n). Then we have:
k(n)={3x(n)+2y(n)+1,v2(n)1,3x(n)+2y(n),v2(n)=1. k(n) = \begin{cases} 3x(n) + 2y(n) + 1, & v_2(n) \neq 1, \\ 3x(n) + 2y(n), & v_2(n) = 1. \end{cases}
For x,yZx, y \in \mathbb{Z} and mZ>0m \in \mathbb{Z}_{>0}, if xyxa(modm)xy \equiv xa \pmod{m}, we denote this as xy(modm)x \to y \pmod{m}. Let pp be a prime factor of nn and pαnp^\alpha \nmid n. For a sequence x1x2xk(modn)x_1 \to x_2 \to \dots \to x_k \pmod{n}, the same relation holds modulo pαp^\alpha:
x1x2xk(modpα). x_1 \to x_2 \to \dots \to x_k \pmod{p^\alpha}.
(1) If xi0(modpα)x_i \neq 0 \pmod{p^\alpha}, then xi+1x_{i+1} is coprime to pp. This is because pαxi(xi+1a)p^\alpha \mid x_i(x_{i+1} - a), and pαxip^\alpha \nmid x_i. Therefore, pxi+1ap \mid x_{i+1} - a. Since aa is coprime to nn, we have pap \nmid a, which implies pxi+1p \nmid x_{i+1}.
(2) If xix_i is coprime to pp, then xi+1a(modpα)x_{i+1} \equiv a \pmod{p^\alpha}. This is because pαxi(xi+1a)p^\alpha \mid x_i(x_{i+1} - a), and since pxip \nmid x_i, we have pαxi+1ap^\alpha \mid x_{i+1} - a.
(3) From (1) and (2), we can conclude that if α2\alpha \ge 2, the sequence x1,x2,,xk(modpα)x_1, x_2, \dots, x_k \pmod{p^\alpha} undergoes at most three changes: it changes from being divisible by pαp^\alpha to being nonzero, then becomes coprime to pp, and finally becomes congruent to aa modulo pαp^\alpha.
If α=1\alpha = 1 and p2p \neq 2, then x1,x2,,xk(modpα)x_1, x_2, \dots, x_k \pmod{p^\alpha} undergo at most two changes: it changes from being congruent to 0 modulo pp to being coprime to pp, and finally becomes congruent to aa modulo pp.
If α=1\alpha = 1 and p=2p = 2, then x1,x2,,xk(modpα)x_1, x_2, \dots, x_k \pmod{p^\alpha} undergo at most one change: it changes from being congruent to 0 modulo 2 to being congruent to aa modulo 2.
Assuming that x1,x2,,xk(modn)x_1, x_2, \dots, x_k \pmod{n} have distinct adjacent terms, then adjacent terms have changes in some modulo pαp^\alpha, implying that kk(n)k \le k(n).
(4) Construct examples for k=k(n)k = k(n). First, consider the cases based on modulo pαp^\alpha.
(i) If α2\alpha \ge 2, we have 0pa+pα1a(modpα)0 \to p \to a + p^{\alpha-1} \to a \pmod{p^\alpha}.
(ii) If α=1\alpha = 1 and p2p \neq 2, we have 0ba(modp)0 \to b \to a \pmod{p}, where bb is coprime to pp and ba(modp)b \neq a \pmod{p}.
(iii) If α=1\alpha = 1 and p=2p = 2, we have 0a(mod2)0 \to a \pmod{2}.
Let n=p1α1pwαwn = p_1^{\alpha_1} \cdots p_w^{\alpha_w} be the prime factorization of nn. For each piαip_i^{\alpha_i}, we choose a sequence corresponding to the three cases mentioned above. Note that 000 \to 0 and aaa \to a. We can appropriately add some zeros at the beginning and some aa's at the end of the sequences to ensure that their lengths reach k(n)k(n). Let's denote these modified sequences as LiL_i. It is required that for piαip_i^{\alpha_i} and pjαjp_j^{\alpha_j} (iji \neq j), the positions where changes occur in LiL_i and LjL_j are different.

For example, suppose α12\alpha_1 \ge 2, we can take
L1:0p1a+p1α11aaa(modp1α1). L_1: 0 \to p_1 \to a + p_1^{\alpha_1-1} \to a \to a \to \dots \to a \pmod{p_1^{\alpha_1}}.
If α2=1\alpha_2 = 1 and p22p_2 \ne 2, we can also take
L2:0000baaa(modp2), L_2: 0 \to 0 \to 0 \to 0 \to b \to a \to a \to \dots \to a \pmod{p_2},
and continue this way to construct L3,,LwL_3, \dots, L_w.
By using the tt-th term of L1,L2,,LwL_1, L_2, \dots, L_w and the Chinese Remainder Theorem, we can determine xtx_t. Since xtxt+1(modpiαi)x_t \to x_{t+1} \pmod{p_i^{\alpha_i}} for 1iw1 \le i \le w, it follows that xtxt+1(modn)x_t \to x_{t+1} \pmod{n}. Moreover, the sequence x1,x2,,xk(n)x_1, x_2, \dots, x_{k(n)} modulo nn has distinct terms. This confirms the conclusion of the original problem, and the maximum value k(n)k(n) is given by the formula mentioned at the beginning of the solution. \square

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.