q$ is analogous; and the claim is true for $p=q$ as $f\left(A_{i}\right)=0$ for all $i$ ). We are ready to prove that at least two of the sets $A_{1}, \ldots, A_{k+\ell}$ are nice. The interval $[-d, d]$ has length $2 d$, and we saw that adjacent numbers in the circular arrangement $f\left(A_{1}\right), \ldots, f\left(A_{k+\ell}\right)$ differ by at most $2 d$. Suppose that $f\left(A_{p}\right)<-d$ and $f\left(A_{q}\right)>d$. Then one of the numbers $f\left(A_{p+1}\right), \ldots, f\left(A_{q-1}\right)$ lies in $[-d, d]$, and also one of the numbers $f\left(A_{q+1}\right), \ldots, f\left(A_{p-1}\right)$ lies there. Consequently, one of the sets $A_{p+1}, \ldots, A_{q-1}$ is nice, as well as one of the sets $A_{q+1}, \ldots, A_{p-1}$. If $-d \leq f\left(A_{p}\right)$ and $f\left(A_{q}\right) \leq d$ then $A_{p}$ and $A_{q}$ are nice. Let now $f\left(A_{p}\right)<-d$ and $f\left(A_{q}\right) \leq d$. Then $f\left(A_{p}\right)+f\left(A_{q}\right)<0$, and since $\sum f\left(A_{i}\right)=0$, there is an $r \neq q$ such that $f\left(A_{r}\right)>0$. We have $02\left(u_{m-1}-u_{1}\right)$ for all $m \geq 3$. Indeed, assume that $u_{m}-u_{1} \leq 2\left(u_{m-1}-u_{1}\right)$ holds for some $m \geq 3$. This inequality can be written as $2\left(u_{m}-u_{m-1}\right) \leq u_{m}-u_{1}$. Take the unique $k$ such that $2^{k} \leq u_{m}-u_{1}<2^{k+1}$. Then $2\left(u_{m}-u_{m-1}\right) \leq u_{m}-u_{1}<2^{k+1}$ yields $u_{m}-u_{m-1}<2^{k}$. However the elements $z=u_{m}, x=u_{1}$, $y=u_{m-1}$ of $S_{a}$ then satisfy $z-y<2^{k}$ and $z-x \geq 2^{k}$, so that $z=u_{m}$ is $k$-good to $S_{a}$. Thus each term of the sequence $u_{2}-u_{1}, u_{3}-u_{1}, \ldots, u_{p}-u_{1}$ is more than twice the previous one. Hence $u_{p}-u_{1}>2^{p-1}\left(u_{2}-u_{1}\right) \geq 2^{p-1}$. But $u_{p} \in\left\{1,2,3, \ldots, 2^{n+1}\right\}$, so that $u_{p} \leq 2^{n+1}$. This yields $p-1 \leq n$, i. e. $p \leq n+1$. In other words, each set $S_{a}$ contains at most $n+1$ elements that are not good to it. To summarize the conclusions, mark with red all elements in the sets $S_{a}$ that are good to the respective set, and with blue the ones that are not good. Then the total number of red elements, counting multiplicities, is at most $n \cdot 2^{n+1}$ (each $z \in A$ can be marked red in at most $n$ sets). The total number of blue elements is at most $(n+1) 2^{n}$ (each set $S_{a}$ contains at most $n+1$ blue elements). Therefore the sum of cardinalities of $S_{1}, S_{2}, \ldots, S_{2^{n}}$ does not exceed $(3 n+1) 2^{n}$. By averaging, the smallest set has at most $3 n+1$ elements. Solution 2. We show that one of the sets $S_{a}$ has at most $2 n+1$ elements. In the sequel $|\cdot|$ denotes the cardinality of a (finite) set. Claim. For $n \geq 2$, suppose that $k$ subsets $S_{1}, \ldots, S_{k}$ of $\left\{1,2, \ldots, 2^{n}\right\}$ (not necessarily different) satisfy the condition of the problem. Then $$ \sum_{i=1}^{k}\left(\left|S_{i}\right|-n\right) \leq(2 n-1) 2^{n-2} $$ Proof. Observe that if the sets $S_{i}(1 \leq i \leq k)$ satisfy the condition then so do their arbitrary subsets $T_{i}(1 \leq i \leq k)$. The condition also holds for the sets $t+S_{i}=\left\{t+x \mid x \in S_{i}\right\}$ where $t$ is arbitrary. Note also that a set may occur more than once among $S_{1}, \ldots, S_{k}$ only if its cardinality is less than 3, in which case its contribution to the sum $\sum_{i=1}^{k}\left(\left|S_{i}\right|-n\right)$ is nonpositive (as $n \geq 2$ ). The proof is by induction on $n$. In the base case $n=2$ we have subsets $S_{i}$ of $\{1,2,3,4\}$. Only the ones of cardinality 3 and 4 need to be considered by the remark above; each one of them occurs at most once among $S_{1}, \ldots, S_{k}$. If $S_{i}=\{1,2,3,4\}$ for some $i$ then no $S_{j}$ is a 3 -element subset in view of the condition, hence $\sum_{i=1}^{k}\left(\left|S_{i}\right|-2\right) \leq 2$. By the condition again, it is impossible that $S_{i}=\{1,3,4\}$ and $S_{j}=\{2,3,4\}$ for some $i, j$. So if $\left|S_{i}\right| \leq 3$ for all $i$ then at most 3 summands $\left|S_{i}\right|-2$ are positive, corresponding to 3 -element subsets. This implies $\sum_{i=1}^{k}\left(\left|S_{i}\right|-2\right) \leq 3$, therefore the conclusion is true for $n=2$. Suppose that the claim holds for some $n \geq 2$, and let the sets $S_{1}, \ldots, S_{k} \subseteq\left\{1,2, \ldots, 2^{n+1}\right\}$ satisfy the given property. Denote $U_{i}=S_{i} \cap\left\{1,2, \ldots, 2^{n}\right\}, V_{i}=S_{i} \cap\left\{2^{n}+1, \ldots, 2^{n+1}\right\}$. Let $$ I=\left\{i|1 \leq i \leq k,| U_{i} \mid \neq 0\right\}, \quad J=\{1, \ldots, k\} \backslash I $$ The sets $S_{j}$ with $j \in J$ are all contained in $\left\{2^{n}+1, \ldots, 2^{n+1}\right\}$, so the induction hypothesis applies to their translates $-2^{n}+S_{j}$ which have the same cardinalities. Consequently, this gives $\sum_{j \in J}\left(\left|S_{j}\right|-n\right) \leq(2 n-1) 2^{n-2}$, so that $$ \sum_{j \in J}\left(\left|S_{j}\right|-(n+1)\right) \leq \sum_{j \in J}\left(\left|S_{j}\right|-n\right) \leq(2 n-1) 2^{n-2} $$ For $i \in I$, denote by $v_{i}$ the least element of $V_{i}$. Observe that if $V_{a}$ and $V_{b}$ intersect, with $a2^{n}$, which implies $z=v_{a}$. It follows that if the element $v_{i}$ is removed from each $V_{i}$, a family of pairwise disjoint sets $W_{i}=V_{i} \backslash\left\{v_{i}\right\}$ is obtained, $i \in I$ (we assume $W_{i}=\emptyset$ if $V_{i}=\emptyset$ ). As $W_{i} \subseteq\left\{2^{n}+1, \ldots, 2^{n+1}\right\}$ for all $i$, we infer that $\sum_{i \in I}\left|W_{i}\right| \leq 2^{n}$. Therefore $\sum_{i \in I}\left(\left|V_{i}\right|-1\right) \leq \sum_{i \in I}\left|W_{i}\right| \leq 2^{n}$. On the other hand, the induction hypothesis applies directly to the sets $U_{i}, i \in I$, so that $\sum_{i \in \mathcal{I}}\left(\left|U_{i}\right|-n\right) \leq(2 n-1) 2^{n-2}$. In summary, $$ \sum_{i \in I}\left(\left|S_{i}\right|-(n+1)\right)=\sum_{i \in I}\left(\left|U_{i}\right|-n\right)+\sum_{i \in I}\left(\left|V_{i}\right|-1\right) \leq(2 n-1) 2^{n-2}+2^{n} $$ The estimates (1) and (2) are sufficient to complete the inductive step: $$ \begin{aligned} \sum_{i=1}^{k}\left(\left|S_{i}\right|-(n+1)\right) & =\sum_{i \in I}\left(\left|S_{i}\right|-(n+1)\right)+\sum_{j \in J}\left(\left|S_{j}\right|-(n+1)\right) \\ & \leq(2 n-1) 2^{n-2}+2^{n}+(2 n-1) 2^{n-2}=(2 n+1) 2^{n-1} \end{aligned} $$ Returning to the problem, consider $k=2^{n}$ subsets $S_{1}, S_{2}, \ldots, S_{2^{n}}$ of $\left\{1,2,3, \ldots, 2^{n+1}\right\}$. If they satisfy the given condition, the claim implies $\sum_{i=1}^{2^{n}}\left(\left|S_{i}\right|-(n+1)\right) \leq(2 n+1) 2^{n-1}$. By averaging again, we see that the smallest set has at most $2 n+1$ elements. Comment. It can happen that each set $S_{i}$ has cardinality at least $n+1$. Here is an example by the proposer. For $i=1, \ldots, 2^{n}$, let $S_{i}=\left\{i+2^{k} \mid 0 \leq k \leq n\right\}$. Then $\left|S_{i}\right|=n+1$ for all $i$. Suppose that there exist $al$. Since $y \in S_{a}$ and $y 180^{\circ}, \end{gathered} $$ point $P$ lies in triangle $C D Q$, and hence in $A B C D$. The proof is complete.  G7. Let $A B C D$ be a convex quadrilateral with $A B \neq B C$. Denote by $\omega_{1}$ and $\omega_{2}$ the incircles of triangles $A B C$ and $A D C$. Suppose that there exists a circle $\omega$ inscribed in angle $A B C$, tangent to the extensions of line segments $A D$ and $C D$. Prove that the common external tangents of $\omega_{1}$ and $\omega_{2}$ intersect on $\omega$. Solution. The proof below is based on two known facts. Lemma 1. Given a convex quadrilateral $A B C D$, suppose that there exists a circle which is inscribed in angle $A B C$ and tangent to the extensions of line segments $A D$ and $C D$. Then $A B+A D=C B+C D$. Proof. The circle in question is tangent to each of the lines $A B, B C, C D, D A$, and the respective points of tangency $K, L, M, N$ are located as with circle $\omega$ in the figure. Then $$ A B+A D=(B K-A K)+(A N-D N), \quad C B+C D=(B L-C L)+(C M-D M) . $$ Also $B K=B L, D N=D M, A K=A N, C L=C M$ by equalities of tangents. It follows that $A B+A D=C B+C D$.  For brevity, in the sequel we write "excircle $A C$ " for the excircle of a triangle with side $A C$ which is tangent to line segment $A C$ and the extensions of the other two sides. Lemma 2. The incircle of triangle $A B C$ is tangent to its side $A C$ at $P$. Let $P P^{\prime}$ be the diameter of the incircle through $P$, and let line $B P^{\prime}$ intersect $A C$ at $Q$. Then $Q$ is the point of tangency of side $A C$ and excircle $A C$. Proof. Let the tangent at $P^{\prime}$ to the incircle $\omega_{1}$ meet $B A$ and $B C$ at $A^{\prime}$ and $C^{\prime}$. Now $\omega_{1}$ is the excircle $A^{\prime} C^{\prime}$ of triangle $A^{\prime} B C^{\prime}$, and it touches side $A^{\prime} C^{\prime}$ at $P^{\prime}$. Since $A^{\prime} C^{\prime} \| A C$, the homothety with centre $B$ and ratio $B Q / B P^{\prime}$ takes $\omega_{1}$ to the excircle $A C$ of triangle $A B C$. Because this homothety takes $P^{\prime}$ to $Q$, the lemma follows. Recall also that if the incircle of a triangle touches its side $A C$ at $P$, then the tangency point $Q$ of the same side and excircle $A C$ is the unique point on line segment $A C$ such that $A P=C Q$. We pass on to the main proof. Let $\omega_{1}$ and $\omega_{2}$ touch $A C$ at $P$ and $Q$, respectively; then $A P=(A C+A B-B C) / 2, C Q=(C A+C D-A D) / 2$. Since $A B-B C=C D-A D$ by Lemma 1, we obtain $A P=C Q$. It follows that in triangle $A B C$ side $A C$ and excircle $A C$ are tangent at $Q$. Likewise, in triangle $A D C$ side $A C$ and excircle $A C$ are tangent at $P$. Note that $P \neq Q$ as $A B \neq B C$. Let $P P^{\prime}$ and $Q Q^{\prime}$ be the diameters perpendicular to $A C$ of $\omega_{1}$ and $\omega_{2}$, respectively. Then Lemma 2 shows that points $B, P^{\prime}$ and $Q$ are collinear, and so are points $D, Q^{\prime}$ and $P$. Consider the diameter of $\omega$ perpendicular to $A C$ and denote by $T$ its endpoint that is closer to $A C$. The homothety with centre $B$ and ratio $B T / B P^{\prime}$ takes $\omega_{1}$ to $\omega$. Hence $B, P^{\prime}$ and $T$ are collinear. Similarly, $D, Q^{\prime}$ and $T$ are collinear since the homothety with centre $D$ and ratio $-D T / D Q^{\prime}$ takes $\omega_{2}$ to $\omega$. We infer that points $T, P^{\prime}$ and $Q$ are collinear, as well as $T, Q^{\prime}$ and $P$. Since $P P^{\prime} \| Q Q^{\prime}$, line segments $P P^{\prime}$ and $Q Q^{\prime}$ are then homothetic with centre $T$. The same holds true for circles $\omega_{1}$ and $\omega_{2}$ because they have $P P^{\prime}$ and $Q Q^{\prime}$ as diameters. Moreover, it is immediate that $T$ lies on the same side of line $P P^{\prime}$ as $Q$ and $Q^{\prime}$, hence the ratio of homothety is positive. In particular $\omega_{1}$ and $\omega_{2}$ are not congruent. In summary, $T$ is the centre of a homothety with positive ratio that takes circle $\omega_{1}$ to circle $\omega_{2}$. This completes the solution, since the only point with the mentioned property is the intersection of the the common external tangents of $\omega_{1}$ and $\omega_{2}$. ## Number Theory N1. Let $n$ be a positive integer and let $p$ be a prime number. Prove that if $a, b, c$ are integers (not necessarily positive) satisfying the equations $$ a^{n}+p b=b^{n}+p c=c^{n}+p a, $$ then $a=b=c$. Solution 1. If two of $a, b, c$ are equal, it is immediate that all the three are equal. So we may assume that $a \neq b \neq c \neq a$. Subtracting the equations we get $a^{n}-b^{n}=-p(b-c)$ and two cyclic copies of this equation, which upon multiplication yield $$ \frac{a^{n}-b^{n}}{a-b} \cdot \frac{b^{n}-c^{n}}{b-c} \cdot \frac{c^{n}-a^{n}}{c-a}=-p^{3} . $$ If $n$ is odd then the differences $a^{n}-b^{n}$ and $a-b$ have the same sign and the product on the left is positive, while $-p^{3}$ is negative. So $n$ must be even. Let $d$ be the greatest common divisor of the three differences $a-b, b-c, c-a$, so that $a-b=d u, b-c=d v, \quad c-a=d w ; \operatorname{gcd}(u, v, w)=1, u+v+w=0$. From $a^{n}-b^{n}=-p(b-c)$ we see that $(a-b) \mid p(b-c)$, i.e., $u \mid p v$; and cyclically $v|p w, w| p u$. As $\operatorname{gcd}(u, v, w)=1$ and $u+v+w=0$, at most one of $u, v, w$ can be divisible by $p$. Supposing that the prime $p$ does not divide any one of them, we get $u|v, v| w, w \mid u$, whence $|u|=|v|=|w|=1$; but this quarrels with $u+v+w=0$. Thus $p$ must divide exactly one of these numbers. Let e.g. $p \mid u$ and write $u=p u_{1}$. Now we obtain, similarly as before, $u_{1}|v, v| w, w \mid u_{1}$ so that $\left|u_{1}\right|=|v|=|w|=1$. The equation $p u_{1}+v+w=0$ forces that the prime $p$ must be even; i.e. $p=2$. Hence $v+w=-2 u_{1}= \pm 2$, implying $v=w(= \pm 1)$ and $u=-2 v$. Consequently $a-b=-2(b-c)$. Knowing that $n$ is even, say $n=2 k$, we rewrite the equation $a^{n}-b^{n}=-p(b-c)$ with $p=2$ in the form $$ \left(a^{k}+b^{k}\right)\left(a^{k}-b^{k}\right)=-2(b-c)=a-b . $$ The second factor on the left is divisible by $a-b$, so the first factor $\left(a^{k}+b^{k}\right)$ must be $\pm 1$. Then exactly one of $a$ and $b$ must be odd; yet $a-b=-2(b-c)$ is even. Contradiction ends the proof. Solution 2. The beginning is as in the first solution. Assuming that $a, b, c$ are not all equal, hence are all distinct, we derive equation (1) with the conclusion that $n$ is even. Write $n=2 k$. Suppose that $p$ is odd. Then the integer $$ \frac{a^{n}-b^{n}}{a-b}=a^{n-1}+a^{n-2} b+\cdots+b^{n-1} $$ which is a factor in (1), must be odd as well. This sum of $n=2 k$ summands is odd only if $a$ and $b$ have different parities. The same conclusion holding for $b, c$ and for $c$, $a$, we get that $a, b, c, a$ alternate in their parities, which is clearly impossible. Thus $p=2$. The original system shows that $a, b, c$ must be of the same parity. So we may divide (1) by $p^{3}$, i.e. $2^{3}$, to obtain the following product of six integer factors: $$ \frac{a^{k}+b^{k}}{2} \cdot \frac{a^{k}-b^{k}}{a-b} \cdot \frac{b^{k}+c^{k}}{2} \cdot \frac{b^{k}-c^{k}}{b-c} \cdot \frac{c^{k}+a^{k}}{2} \cdot \frac{c^{k}-a^{k}}{c-a}=-1 . $$ Each one of the factors must be equal to $\pm 1$. In particular, $a^{k}+b^{k}= \pm 2$. If $k$ is even, this becomes $a^{k}+b^{k}=2$ and yields $|a|=|b|=1$, whence $a^{k}-b^{k}=0$, contradicting (2). Let now $k$ be odd. Then the sum $a^{k}+b^{k}$, with value $\pm 2$, has $a+b$ as a factor. Since $a$ and $b$ are of the same parity, this means that $a+b= \pm 2$; and cyclically, $b+c= \pm 2, c+a= \pm 2$. In some two of these equations the signs must coincide, hence some two of $a, b, c$ are equal. This is the desired contradiction. Comment. Having arrived at the equation (1) one is tempted to write down all possible decompositions of $-p^{3}$ (cube of a prime) into a product of three integers. This leads to cumbersome examination of many cases, some of which are unpleasant to handle. One may do that just for $p=2$, having earlier in some way eliminated odd primes from consideration. However, the second solution shows that the condition of $p$ being a prime is far too strong. What is actually being used in that solution, is that $p$ is either a positive odd integer or $p=2$. N2. Let $a_{1}, a_{2}, \ldots, a_{n}$ be distinct positive integers, $n \geq 3$. Prove that there exist distinct indices $i$ and $j$ such that $a_{i}+a_{j}$ does not divide any of the numbers $3 a_{1}, 3 a_{2}, \ldots, 3 a_{n}$. Solution. Without loss of generality, let $0 a_{n-1}\right)$. Thus $3 a_{n-1}=a_{n}+a_{n-1}$, i. e. $a_{n}=2 a_{n-1}$. Similarly, if $j=n$ then $3 a_{n}=k\left(a_{n}+a_{n-1}\right)$ for some integer $k$, and only $k=2$ is possible. Hence $a_{n}=2 a_{n-1}$ holds true in both cases remaining, $j=n-1$ and $j=n$. Now $a_{n}=2 a_{n-1}$ implies that the sum $a_{n-1}+a_{1}$ is strictly between $a_{n} / 2$ and $a_{n}$. But $a_{n-1}$ and $a_{1}$ are distinct as $n \geq 3$, so it follows from the above that $a_{n-1}+a_{1}$ divides $a_{n}$. This provides the desired contradiction. N3. Let $a_{0}, a_{1}, a_{2}, \ldots$ be a sequence of positive integers such that the greatest common divisor of any two consecutive terms is greater than the preceding term; in symbols, $\operatorname{gcd}\left(a_{i}, a_{i+1}\right)>a_{i-1}$. Prove that $a_{n} \geq 2^{n}$ for all $n \geq 0$. Solution. Since $a_{i} \geq \operatorname{gcd}\left(a_{i}, a_{i+1}\right)>a_{i-1}$, the sequence is strictly increasing. In particular $a_{0} \geq 1, a_{1} \geq 2$. For each $i \geq 1$ we also have $a_{i+1}-a_{i} \geq \operatorname{gcd}\left(a_{i}, a_{i+1}\right)>a_{i-1}$, and consequently $a_{i+1} \geq a_{i}+a_{i-1}+1$. Hence $a_{2} \geq 4$ and $a_{3} \geq 7$. The equality $a_{3}=7$ would force equalities in the previous estimates, leading to $\operatorname{gcd}\left(a_{2}, a_{3}\right)=\operatorname{gcd}(4,7)>a_{1}=2$, which is false. Thus $a_{3} \geq 8$; the result is valid for $n=0,1,2,3$. These are the base cases for a proof by induction. Take an $n \geq 3$ and assume that $a_{i} \geq 2^{i}$ for $i=0,1, \ldots, n$. We must show that $a_{n+1} \geq 2^{n+1}$. Let $\operatorname{gcd}\left(a_{n}, a_{n+1}\right)=d$. We know that $d>a_{n-1}$. The induction claim is reached immediately in the following cases: $$ \begin{array}{ll} \text { if } \quad a_{n+1} \geq 4 d & \text { then } a_{n+1}>4 a_{n-1} \geq 4 \cdot 2^{n-1}=2^{n+1} \\ \text { if } \quad a_{n} \geq 3 d & \text { then } a_{n+1} \geq a_{n}+d \geq 4 d>4 a_{n-1} \geq 4 \cdot 2^{n-1}=2^{n+1} \\ \text { if } \quad a_{n}=d & \text { then } a_{n+1} \geq a_{n}+d=2 a_{n} \geq 2 \cdot 2^{n}=2^{n+1} \end{array} $$ The only remaining possibility is that $a_{n}=2 d$ and $a_{n+1}=3 d$, which we assume for the sequel. So $a_{n+1}=\frac{3}{2} a_{n}$. Let now $\operatorname{gcd}\left(a_{n-1}, a_{n}\right)=d^{\prime}$; then $d^{\prime}>a_{n-2}$. Write $a_{n}=m d^{\prime} \quad(m$ an integer $)$. Keeping in mind that $d^{\prime} \leq a_{n-1} 9 a_{n-2} \geq 9 \cdot 2^{n-2}>2^{n+1} \\ & \text { if } 3 \leq m \leq 4 \text { then } a_{n-1}<\frac{1}{2} \cdot 4 d^{\prime} \text {, and hence } a_{n-1}=d^{\prime} \\ & \qquad a_{n+1}=\frac{3}{2} m a_{n-1} \geq \frac{3}{2} \cdot 3 a_{n-1} \geq \frac{9}{2} \cdot 2^{n-1}>2^{n+1} . \end{aligned} $$ So we are left with the case $m=5$, which means that $a_{n}=5 d^{\prime}, a_{n+1}=\frac{15}{2} d^{\prime}, a_{n-1} a_{n-3}$. Because $d^{\prime \prime}$ is a divisor of $a_{n-1}$, hence also of $2 d^{\prime}$, we may write $2 d^{\prime}=m^{\prime} d^{\prime \prime}$ ( $m^{\prime}$ an integer). Since $d^{\prime \prime} \leq a_{n-2} \frac{75}{4} a_{n-3} \geq \frac{75}{4} \cdot 2^{n-3}>2^{n+1} \\ & \text { if } 3 \leq m^{\prime} \leq 4 \text { then } a_{n-2}<\frac{1}{2} \cdot 4 d^{\prime \prime} \text {, and hence } a_{n-2}=d^{\prime \prime} \\ & \qquad a_{n+1}=\frac{15}{4} m^{\prime} a_{n-2} \geq \frac{15}{4} \cdot 3 a_{n-2} \geq \frac{45}{4} \cdot 2^{n-2}>2^{n+1} . \end{aligned} $$ Both of them have produced the induction claim. But now there are no cases left. Induction is complete; the inequality $a_{n} \geq 2^{n}$ holds for all $n$. N4. Let $n$ be a positive integer. Show that the numbers $$ \left(\begin{array}{c} 2^{n}-1 \\ 0 \end{array}\right), \quad\left(\begin{array}{c} 2^{n}-1 \\ 1 \end{array}\right), \quad\left(\begin{array}{c} 2^{n}-1 \\ 2 \end{array}\right), \quad \ldots, \quad\left(\begin{array}{c} 2^{n}-1 \\ 2^{n-1}-1 \end{array}\right) $$ are congruent modulo $2^{n}$ to $1,3,5, \ldots, 2^{n}-1$ in some order. Solution 1. It is well-known that all these numbers are odd. So the assertion that their remainders $\left(\bmod 2^{n}\right)$ make up a permutation of $\left\{1,3, \ldots, 2^{n}-1\right\}$ is equivalent just to saying that these remainders are all distinct. We begin by showing that $$ \left(\begin{array}{c} 2^{n}-1 \\ 2 k \end{array}\right)+\left(\begin{array}{c} 2^{n}-1 \\ 2 k+1 \end{array}\right) \equiv 0 \quad\left(\bmod 2^{n}\right) \quad \text { and } \quad\left(\begin{array}{c} 2^{n}-1 \\ 2 k \end{array}\right) \equiv(-1)^{k}\left(\begin{array}{c} 2^{n-1}-1 \\ k \end{array}\right) \quad\left(\bmod 2^{n}\right) $$ The first relation is immediate, as the sum on the left is equal to $\left(\begin{array}{c}2^{n} \\ 2 k+1\end{array}\right)=\frac{2^{n}}{2 k+1}\left(\begin{array}{c}2^{n}-1 \\ 2 k\end{array}\right)$, hence is divisible by $2^{n}$. The second relation: $$ \left(\begin{array}{c} 2^{n}-1 \\ 2 k \end{array}\right)=\prod_{j=1}^{2 k} \frac{2^{n}-j}{j}=\prod_{i=1}^{k} \frac{2^{n}-(2 i-1)}{2 i-1} \cdot \prod_{i=1}^{k} \frac{2^{n-1}-i}{i} \equiv(-1)^{k}\left(\begin{array}{c} 2^{n-1}-1 \\ k \end{array}\right) \quad\left(\bmod 2^{n}\right) . $$ This prepares ground for a proof of the required result by induction on $n$. The base case $n=1$ is obvious. Assume the assertion is true for $n-1$ and pass to $n$, denoting $a_{k}=\left(\begin{array}{c}2^{n-1}-1 \\ k\end{array}\right)$, $b_{m}=\left(\begin{array}{c}2^{n}-1 \\ m\end{array}\right)$. The induction hypothesis is that all the numbers $a_{k}\left(0 \leq k<2^{n-2}\right)$ are distinct $\left(\bmod 2^{n-1}\right)$; the claim is that all the numbers $b_{m}\left(0 \leq m<2^{n-1}\right)$ are distinct $\left(\bmod 2^{n}\right)$. The congruence relations (1) are restated as $$ b_{2 k} \equiv(-1)^{k} a_{k} \equiv-b_{2 k+1} \quad\left(\bmod 2^{n}\right) $$ Shifting the exponent in the first relation of (1) from $n$ to $n-1$ we also have the congruence $a_{2 i+1} \equiv-a_{2 i}\left(\bmod 2^{n-1}\right)$. We hence conclude: If, for some $j, k<2^{n-2}, a_{k} \equiv-a_{j}\left(\bmod 2^{n-1}\right)$, then $\{j, k\}=\{2 i, 2 i+1\}$ for some $i$. This is so because in the sequence $\left(a_{k}: k<2^{n-2}\right)$ each term $a_{j}$ is complemented to $0\left(\bmod 2^{n-1}\right)$ by only one other term $a_{k}$, according to the induction hypothesis. From (2) we see that $b_{4 i} \equiv a_{2 i}$ and $b_{4 i+3} \equiv a_{2 i+1}\left(\bmod 2^{n}\right)$. Let $$ M=\left\{m: 0 \leq m<2^{n-1}, m \equiv 0 \text { or } 3(\bmod 4)\right\}, \quad L=\left\{l: 0 \leq l<2^{n-1}, l \equiv 1 \text { or } 2(\bmod 4)\right\} $$ The last two congruences take on the unified form $$ b_{m} \equiv a_{\lfloor m / 2\rfloor} \quad\left(\bmod 2^{n}\right) \quad \text { for all } \quad m \in M $$ Thus all the numbers $b_{m}$ for $m \in M$ are distinct $\left(\bmod 2^{n}\right)$ because so are the numbers $a_{k}$ (they are distinct $\left(\bmod 2^{n-1}\right)$, hence also $\left(\bmod 2^{n}\right)$ ). Every $l \in L$ is paired with a unique $m \in M$ into a pair of the form $\{2 k, 2 k+1\}$. So (2) implies that also all the $b_{l}$ for $l \in L$ are distinct $\left(\bmod 2^{n}\right)$. It remains to eliminate the possibility that $b_{m} \equiv b_{l}\left(\bmod 2^{n}\right)$ for some $m \in M, l \in L$. Suppose that such a situation occurs. Let $m^{\prime} \in M$ be such that $\left\{m^{\prime}, l\right\}$ is a pair of the form $\{2 k, 2 k+1\}$, so that $($ see $(2)) b_{m^{\prime}} \equiv-b_{l}\left(\bmod 2^{n}\right)$. Hence $b_{m^{\prime}} \equiv-b_{m}\left(\bmod 2^{n}\right)$. Since both $m^{\prime}$ and $m$ are in $M$, we have by (4) $b_{m^{\prime}} \equiv a_{j}, b_{m} \equiv a_{k}\left(\bmod 2^{n}\right)$ for $j=\left\lfloor m^{\prime} / 2\right\rfloor, k=\lfloor m / 2\rfloor$. Then $a_{j} \equiv-a_{k}\left(\bmod 2^{n}\right)$. Thus, according to $(3), j=2 i, k=2 i+1$ for some $i$ (or vice versa). The equality $a_{2 i+1} \equiv-a_{2 i}\left(\bmod 2^{n}\right)$ now means that $\left(\begin{array}{c}2^{n-1}-1 \\ 2 i\end{array}\right)+\left(\begin{array}{c}2^{n-1}-1 \\ 2 i+1\end{array}\right) \equiv 0\left(\bmod 2^{n}\right)$. However, the sum on the left is equal to $\left(\begin{array}{c}2^{n-1} \\ 2 i+1\end{array}\right)$. A number of this form cannot be divisible by $2^{n}$. This is a contradiction which concludes the induction step and proves the result. Solution 2. We again proceed by induction, writing for brevity $N=2^{n-1}$ and keeping notation $a_{k}=\left(\begin{array}{c}N-1 \\ k\end{array}\right), b_{m}=\left(\begin{array}{c}2 N-1 \\ m\end{array}\right)$. Assume that the result holds for the sequence $\left(a_{0}, a_{1}, a_{2}, \ldots, a_{N / 2-1}\right)$. In view of the symmetry $a_{N-1-k}=a_{k}$ this sequence is a permutation of $\left(a_{0}, a_{2}, a_{4}, \ldots, a_{N-2}\right)$. So the induction hypothesis says that this latter sequence, taken $(\bmod N)$, is a permutation of $(1,3,5, \ldots, N-1)$. Similarly, the induction claim is that $\left(b_{0}, b_{2}, b_{4}, \ldots, b_{2 N-2}\right)$, taken $(\bmod 2 N)$, is a permutation of $(1,3,5, \ldots, 2 N-1)$. In place of the congruence relations (2) we now use the following ones, $$ b_{4 i} \equiv a_{2 i} \quad(\bmod N) \quad \text { and } \quad b_{4 i+2} \equiv b_{4 i}+N \quad(\bmod 2 N) . $$ Given this, the conclusion is immediate: the first formula of (5) together with the induction hypothesis tells us that $\left(b_{0}, b_{4}, b_{8}, \ldots, b_{2 N-4}\right)(\bmod N)$ is a permutation of $(1,3,5, \ldots, N-1)$. Then the second formula of $(5)$ shows that $\left(b_{2}, b_{6}, b_{10}, \ldots, b_{2 N-2}\right)(\bmod N)$ is exactly the same permutation; moreover, this formula distinguishes $(\bmod 2 N)$ each $b_{4 i}$ from $b_{4 i+2}$. Consequently, these two sequences combined represent $(\bmod 2 N)$ a permutation of the sequence $(1,3,5, \ldots, N-1, N+1, N+3, N+5, \ldots, N+N-1)$, and this is precisely the induction claim. Now we prove formulas (5); we begin with the second one. Since $b_{m+1}=b_{m} \cdot \frac{2 N-m-1}{m+1}$, $$ b_{4 i+2}=b_{4 i} \cdot \frac{2 N-4 i-1}{4 i+1} \cdot \frac{2 N-4 i-2}{4 i+2}=b_{4 i} \cdot \frac{2 N-4 i-1}{4 i+1} \cdot \frac{N-2 i-1}{2 i+1} . $$ The desired congruence $b_{4 i+2} \equiv b_{4 i}+N$ may be multiplied by the odd number $(4 i+1)(2 i+1)$, giving rise to a chain of successively equivalent congruences: $$ \begin{aligned} b_{4 i}(2 N-4 i-1)(N-2 i-1) & \equiv\left(b_{4 i}+N\right)(4 i+1)(2 i+1) & & (\bmod 2 N), \\ b_{4 i}(2 i+1-N) & \equiv\left(b_{4 i}+N\right)(2 i+1) & & (\bmod 2 N), \\ \left(b_{4 i}+2 i+1\right) N & \equiv 0 & & (\bmod 2 N) ; \end{aligned} $$ and the last one is satisfied, as $b_{4 i}$ is odd. This settles the second relation in (5). The first one is proved by induction on $i$. It holds for $i=0$. Assume $b_{4 i} \equiv a_{2 i}(\bmod 2 N)$ and consider $i+1$ : $$ b_{4 i+4}=b_{4 i+2} \cdot \frac{2 N-4 i-3}{4 i+3} \cdot \frac{2 N-4 i-4}{4 i+4} ; \quad a_{2 i+2}=a_{2 i} \cdot \frac{N-2 i-1}{2 i+1} \cdot \frac{N-2 i-2}{2 i+2} . $$ Both expressions have the fraction $\frac{N-2 i-2}{2 i+2}$ as the last factor. Since $2 i+2 1$. Direct verification shows that this function meets the requirements. Conversely, let $f: \mathbb{N} \rightarrow \mathbb{N}$ satisfy (i) and (ii). Applying (i) for $x=1$ gives $d(f(1))=1$, so $f(1)=1$. In the sequel we prove that (1) holds for all $n>1$. Notice that $f(m)=f(n)$ implies $m=n$ in view of (i). The formula $d\left(p_{1}^{b_{1}} \cdots p_{k}^{b_{k}}\right)=\left(b_{1}+1\right) \cdots\left(b_{k}+1\right)$ will be used throughout. Let $p$ be a prime. Since $d(f(p))=p$, the formula just mentioned yields $f(p)=q^{p-1}$ for some prime $q$; in particular $f(2)=q^{2-1}=q$ is a prime. We prove that $f(p)=p^{p-1}$ for all primes $p$. Suppose that $p$ is odd and $f(p)=q^{p-1}$ for a prime $q$. Applying (ii) first with $x=2$, $y=p$ and then with $x=p, y=2$ shows that $f(2 p)$ divides both $(2-1) p^{2 p-1} f(2)=p^{2 p-1} f(2)$ and $(p-1) 2^{2 p-1} f(p)=(p-1) 2^{2 p-1} q^{p-1}$. If $q \neq p$ then the odd prime $p$ does not divide $(p-1) 2^{2 p-1} q^{p-1}$, hence the greatest common divisor of $p^{2 p-1} f(2)$ and $(p-1) 2^{2 p-1} q^{p-1}$ is a divisor of $f(2)$. Thus $f(2 p)$ divides $f(2)$ which is a prime. As $f(2 p)>1$, we obtain $f(2 p)=f(2)$ which is impossible. So $q=p$, i. e. $f(p)=p^{p-1}$. For $p=2$ the same argument with $x=2, y=3$ and $x=3, y=2$ shows that $f(6)$ divides both $3^{5} f(2)$ and $2^{6} f(3)=2^{6} 3^{2}$. If the prime $f(2)$ is odd then $f(6)$ divides $3^{2}=9$, so $f(6) \in\{1,3,9\}$. However then $6=d(f(6)) \in\{d(1), d(3), d(9)\}=\{1,2,3\}$ which is false. In conclusion $f(2)=2$. Next, for each $n>1$ the prime divisors of $f(n)$ are among the ones of $n$. Indeed, let $p$ be the least prime divisor of $n$. Apply (ii) with $x=p$ and $y=n / p$ to obtain that $f(n)$ divides $(p-1) y^{n-1} f(p)=(p-1) y^{n-1} p^{p-1}$. Write $f(n)=\ell P$ where $\ell$ is coprime to $n$ and $P$ is a product of primes dividing $n$. Since $\ell$ divides $(p-1) y^{n-1} p^{p-1}$ and is coprime to $y^{n-1} p^{p-1}$, it divides $p-1$; hence $d(\ell) \leq \ell 1$ ). So $f\left(p^{a}\right)=p^{b}$ for some $b \geq 1$, and (i) yields $p^{a}=d\left(f\left(p^{a}\right)\right)=d\left(p^{b}\right)=b+1$. Hence $f\left(p^{a}\right)=p^{p^{a}-1}$, as needed. Let us finally show that (1) is true for a general $n>1$ with prime factorization $n=p_{1}^{a_{1}} \cdots p_{k}^{a_{k}}$. We saw that the prime factorization of $f(n)$ has the form $f(n)=p_{1}^{b_{1}} \cdots p_{k}^{b_{k}}$. For $i=1, \ldots, k$, set $x=p_{i}^{a_{i}}$ and $y=n / x$ in (ii) to infer that $f(n)$ divides $\left(p_{i}^{a_{i}}-1\right) y^{n-1} f\left(p_{i}^{a_{i}}\right)$. Hence $p_{i}^{b_{i}}$ divides $\left(p_{i}^{a_{i}}-1\right) y^{n-1} f\left(p_{i}^{a_{i}}\right)$, and because $p_{i}^{b_{i}}$ is coprime to $\left(p_{i}^{a_{i}}-1\right) y^{n-1}$, it follows that $p_{i}^{b_{i}}$ divides $f\left(p_{i}^{a_{i}}\right)=p_{i}^{p_{i}^{a_{i}}-1}$. So $b_{i} \leq p_{i}^{a_{i}}-1$ for all $i=1, \ldots, k$. Combined with (i), these conclusions imply $$ p_{1}^{a_{1}} \cdots p_{k}^{a_{k}}=n=d(f(n))=d\left(p_{1}^{b_{1}} \cdots p_{k}^{b_{k}}\right)=\left(b_{1}+1\right) \cdots\left(b_{k}+1\right) \leq p_{1}^{a_{1}} \cdots p_{k}^{a_{k}} . $$ Hence all inequalities $b_{i} \leq p_{i}^{a_{i}}-1$ must be equalities, $i=1, \ldots, k$, implying that (1) holds true. The proof is complete. N6. Prove that there exist infinitely many positive integers $n$ such that $n^{2}+1$ has a prime divisor greater than $2 n+\sqrt{2 n}$. Solution. Let $p \equiv 1(\bmod 8)$ be a prime. The congruence $x^{2} \equiv-1(\bmod p)$ has two solutions in $[1, p-1]$ whose sum is $p$. If $n$ is the smaller one of them then $p$ divides $n^{2}+1$ and $n \leq(p-1) / 2$. We show that $p>2 n+\sqrt{10 n}$. Let $n=(p-1) / 2-\ell$ where $\ell \geq 0$. Then $n^{2} \equiv-1(\bmod p)$ gives $$ \left(\frac{p-1}{2}-\ell\right)^{2} \equiv-1 \quad(\bmod p) \quad \text { or } \quad(2 \ell+1)^{2}+4 \equiv 0 \quad(\bmod p) $$ Thus $(2 \ell+1)^{2}+4=r p$ for some $r \geq 0$. As $(2 \ell+1)^{2} \equiv 1 \equiv p(\bmod 8)$, we have $r \equiv 5(\bmod 8)$, so that $r \geq 5$. Hence $(2 \ell+1)^{2}+4 \geq 5 p$, implying $\ell \geq(\sqrt{5 p-4}-1) / 2$. Set $\sqrt{5 p-4}=u$ for clarity; then $\ell \geq(u-1) / 2$. Therefore $$ n=\frac{p-1}{2}-\ell \leq \frac{1}{2}(p-u) $$ Combined with $p=\left(u^{2}+4\right) / 5$, this leads to $u^{2}-5 u-10 n+4 \geq 0$. Solving this quadratic inequality with respect to $u \geq 0$ gives $u \geq(5+\sqrt{40 n+9}) / 2$. So the estimate $n \leq(p-u) / 2$ leads to $$ p \geq 2 n+u \geq 2 n+\frac{1}{2}(5+\sqrt{40 n+9})>2 n+\sqrt{10 n} $$ Since there are infinitely many primes of the form $8 k+1$, it follows easily that there are also infinitely many $n$ with the stated property. Comment. By considering the prime factorization of the product $\prod_{n=1}^{N}\left(n^{2}+1\right)$, it can be obtained that its greatest prime divisor is at least $c N \log N$. This could improve the statement as $p>n \log n$. However, the proof applies some advanced information about the distribution of the primes of the form $4 k+1$, which is inappropriate for high schools contests.