We call a positive integer $n\ge 4$ beautiful if there exists some permutation $$\{x_1,x_2,\dots ,x_{n-1}\}$$of $\{1,2,\dots ,n-1\}$ such that $\{x^1_1,\ x^2_2,\ \dots,x^{n-1}_{n-1}\}$ gives all the residues $\{1,2,\dots, n-1\}$ modulo $n$. Prove that if $n$ is beautiful then $n=2p,$ for some prime number $p.$
Problem
Source: 1st TASIMO Day2, Problem6
Tags: abstract algebra, number theory, complete residue system
19.05.2024 13:54
It's sad to see a well-known problem (even featured in an OTIS unit) appear on an international olympiad. Quote: Find all integers $n \ge 2$ for which there exists a permutation $(e_1, \dots, e_{n-1})$ of $(1, \dots, n-1)$ such that the numbers \[ 1^{e_1}, \quad 2^{e_2}, \quad \dots, \quad (n-1)^{e_{n-1}} \]leave distinct nonzero remainders when divided by $n$. We'll prove something stronger. If $n> 4$, then $n = 2p$ for an odd prime $p$ such that $p-1$ is square-free. Furthermore, all such $n$ are beautiful (a construction is given here). Claim 1. For all primes $p$ and any beautiful $n$, we have $\nu_{p}(n) \leq 2$. Proof: Assume the contrary and let $n = p^{\alpha}N$ for $\gcd(p, N) = 1$ and $\alpha\geq 3$. Notice that: \[(p^{\alpha-1}N)^{\lambda_{1}}, (p^{\alpha-2}N)^{\lambda_{2}} \pmod n \in \{pN, p^2N, \cdots, p^{\alpha-1}N\}\]This directly implies that $\lambda_{1} = 1$ as $(p^{\alpha-1}N)^{\lambda_{1}} \equiv 0 \pmod n$ otherwise. Furthermore, now $\alpha-2>1$, so: \[\nu_{p}((p^{\alpha-2}N)^{\lambda_{2}}) > \alpha - 2 \Longrightarrow (p^{\alpha-2}N)^{\lambda_{2}} \pmod n \in \{p^{\alpha - 1}N, 0\}\]which is a contradiction as $(p^{\alpha-1}N)^{\lambda_{1}} \equiv p^{\alpha-1}N\pmod n$. The conclusion follows. Now let $n = p_{1}^{2}p_{2}^{2} \cdots p_{k}^{2} q_{1}q_{2} \cdots q_{m}$ be the prime factorization of a beautiful $n$. Claim 2. We have $k \leq 1$. Proof: Assume the contrary. Then $n = p_{1}^2 p_{2}^2 N$ for $\gcd(p_{1}p_{2}, N) = 1$ and some primes $p_{1} \neq p_{2}$. In that case, notice that we require \[(p_{1}p_{2}^2N)^{\lambda_{1}} \equiv p_{1}p_{2}^2N \pmod n\]\[(p_{1}^2p_{2}N)^{\lambda_{2}} \equiv p_{1}^2p_{2}N \pmod n\]which is only possible if $\lambda_{1} = 1 = \lambda_{2}$, contradiction (if any of the lambdas is greater than one, the respective integer would be congruent to $0$ modulo $n$). Therefore, if $n$ is beautiful, then either $n$ is square-free, or $n$ is a square of a prime multiplied by a square-free integer. It turns out that the second option is impossible unless $n = 4$. We discuss the first option in the claim after that. Claim 3. If $k = 1$, then $n = 4$. Proof: Let $n = p^2Q$ where $Q$ is square-free. Consider the residues $p, 2p, \cdots, p(pQ-1)$. At least $pQ-2$ of them would result in residues divisible by $p^2$ after considering the powers $e_{i}$. As they also have to be different, notice that: \[pQ-2 \leq Q-1\]On the other hand $pQ-2 \geq 2Q - 2 = 2(Q-1)$, so equality occurs if and only if $p=2$ and $Q=1$, so $\boxed{n=4}$. This is indeed a solution by picking $e_{1} = 2$, $e_{2} = 1$, $e_{3} = 3$. Claim 4. If $n$ is square-free, then $n = p$ or $n = 2p$ for a prime $p$. Proof: Consider the function $\text{qr}\colon \mathbb{P} \to \mathbb{N}$ defined by \[\text{qr}(p) = \left\{\begin{array}{lr} 2, & p = 2\\ \frac{1}{2}(p+1), & \text{otherwise} \end{array}\right.\]counting the number of quadratic residues modulo a prime $p$. For square-free $n$, the number of quadratic residues modulo $n$ is $\prod\limits_{p\mid n} \text{qr}(p)$. Notice that $k^{e_{k}}$ is a QR modulo $n$ if $k$ is a QR or if $e_{k}$ is even. This implies that all even $e_{k}$ must match with QR $k$'s. Otherwise the set $k^{e_{k}} \pmod n$ would have more QR's than the set $k\pmod n$, impossible, which implies the inequality (taking into account that zero is also a QR, hence the $+1$): \[\left\lfloor\frac{1}{2}(n-1)\right\rfloor + 1 \leq \prod\limits_{p\mid n} \text{qr}(p)\]Let $n = q_{1}q_{2} \cdots q_{m}$. If $m\geq 3$, we get that: \begin{align*} \frac{1}{2}(n-1) &< \left\lfloor\frac{1}{2}(n-1)\right\rfloor + 1 \\ &\leq \prod\limits_{i=1}^{m} \text{qr}(q_{i}) \\ &\leq \frac{n}{q_{m-1}q_{m}}\cdot \frac{q_{m-1}+1}{2} \cdot \frac{q_{m}+1}{2} \\ &= \frac{n}{4}\cdot \frac{q_{m-1}+1}{q_{m-1}} \cdot \frac{q_{m}+1}{q_{m}} \\ &\leq \frac{n}{4} \cdot \frac{4}{3} \cdot \frac{6}{5} \\ &= \frac{2n}{5} \end{align*}This is clearly a contradiction as $m\geq 3$, so $n\geq 2 \cdot 3 \cdot 5 = 30$ and \[\frac{1}{2}(n-1) < \frac{2n}{5} \iff n<5\]This leaves us with the cases $n = q_{1}$ and $n = q_{1}q_{2}$. In the latter, if $q_{1} > 2$, we once again derive a contradiction as shown above, so this boils down to $n = 2q_{1}$. Claim 5. If $n = p$ is a beautiful prime, then $n = 2$ or $3$. Proof: Clearly, $\boxed{p = 2}$ and $\boxed{p = 3}$ are solutions by taking $e_{1} = 1$ for $p = 2$ and $(e_{1}, e_{2}) = (2, 1)$ for $p = 3$. We now consider only $p \geq 5$. As mentioned, if $r$ is not a QR modulo $p$, then $e_{r}$ must be odd. As there are $\frac{p-1}{2}$ non-QRs, they occupy all the odd powers and, therefore, if $r$ is a QR modulo $p$, then $e_{r}$ is even as well. This immediately implies that we must have $p \equiv 3\pmod 4$ as otherwise we'd get: \[1^{e_{1}} \equiv 1 \equiv (p-1)^{e_{p-1}} \pmod p\]because $-1$ is a QR modulo $p$ if $p \equiv 1 \pmod 4$. Now we deal with the $p\equiv 3\pmod 4$ case. Let $r$ be an odd prime divisor of $p-1$; denote $\nu_{r}(p-1) = s$. Such an $r$ exists because $p\equiv 3\pmod 4$ and $p > 3$. Consider the set of residues \[M = \left\{g^{\frac{k}{r^s}(p-1)} \pmod p \mid \gcd(k, r) = 1 \right\}\]where $g$ is a primitive root modulo $p$. Also, denote \[M^{*} = \left\{\frac{k}{r^s}(p-1) \pmod{p-1} \mid \gcd(k, r) = 1 \right\}\]It's easy to see that for $p$ to be beautiful, there must exist a permutation $\sigma\colon M^{*} \to M^{*}$ such that the sets \[\{x \mid x\in M^{*}\}\qquad \text{and} \qquad \{x\sigma(x) \mid x\in M^{*}\}\]taken modulo $p-1$ are the same. This implies that \[\prod\limits_{x \in M^{*}} x \equiv \prod\limits_{x \in M^{*}} x\sigma(x) \equiv \left(\prod\limits_{x \in M^{*}} x\right)^2 \pmod{p-1}\]by taking the product of all elements modulo $p-1$. Considering only modulo $r^s$, we get \[\prod\limits_{x \in M^{*}} x \equiv 1 \pmod{r^{s}}\]or equivalently, the LHS could be rewritten as: \[\left(\prod\limits_{i=1}^{r-1} i \right)^{r^{s-1}} \equiv 1 \pmod{r^{s}} \]By Wilson's theorem, the LHS is congruent to $-1 \pmod r$, which is a contradiction. We now focus on the case $n = 2p$ where $p$ is prime. Claim 6. If $n = 2p$ is beautiful, then $p-1$ must be square-free. Proof: Assume the contrary. We already showed that $\nu_{2}(p-1) = 1$, so the only remaining possibility is there exists an odd prime $t$ (I usually don't use this letter to denote primes, but I want to avoid repetition of $q$ and $r$) such that $t^2 \mid p-1$. We easily get a contradiction following the concepts of the third claim. Let $g$ be a primitive root modulo $2p$ and consider the set of residues \[\mathcal{F} = \{g^{t}, g^{2t}, \cdots, g^{p-1}\}\cup\{2^{p-1}g^t, 2^{p-1}g^{2t}, \cdots, 2^{p-1}g^{p-1}\}\]Clearly, if $x\in \mathcal{F}$, then $x$ raised to any power modulo $2p$ remains in $\mathcal{F}$. Hence for any $y \not\in \mathcal{F}$ we must have $y^{e_{y}} \not\in \mathcal{F}$, therefore if $t\mid e_{x}$ for any $x$, then $x\in \mathcal{F}$ or $x = p$. Therefore we'd have at least $\frac{2(p-1)}{t}-1$ residues $x^{e_{x}}$ in the set: \[\mathcal{F}^{*} = \{g^{t^2}, g^{2t^2}, \cdots, g^{p-1}\}\cup\{2^{p-1}g^{t^2}, 2^{p-1}g^{2t^2}, \cdots, 2^{p-1}g^{p-1}\}\]implying the inequality \[\frac{2(p-1)}{t^2} = |\mathcal{F}^{*}| \geq |\mathcal{F}| = \frac{2(p-1)}{t}-1\]which rewrites as \[0 \geq 2(p-1)(t-1) - t^2\]However, $t^2\mid p-1$, so $p-1 \geq 2t^2$, and we have our final contradiction: \[0 \geq 2(p-1)(t-1) - t^2 \geq 4t^2(t-1) - t^2 = (4t-5)t^2 > 0\]With this we've shown that if $2p$ is beautiful, then $p - 1 = 2t_{1}t_{2}\cdots t_{s}$ for distinct odd primes $t_{i}$.
19.05.2024 13:58
Indeed, Theorem 1.3 from the paper by Evan which @Marinchoo posted is a problem I really like to teach. I started solving today's one in the same manner (prove squarefreeness, then small number of factors, then classify, this strategy btw is also in EGMO 2024/3) and got interrupted by the sad news that it is actually the other problem from the same paper... I'd be interested in Evan's reaction if this appears as a surprise request at Twitch Solves ISL. At least, let's hope that no contestant has had any clue of this problem before, then it's fairer as it is a great problem!
15.08.2024 10:52
It is also appeared in China north MO in 2024.