$$ 1 / c)^{4} $$ Jnlernelionell jelinemeliled c) IVfGlolel arin Julys $10-222008$ in, wadrid spain ![](https://cdn.mathpix.com/cropped/2024_04_17_e32cef0f3c5b05a0a6b1g-01.jpg?height=1477&width=2089&top_left_y=1306&top_left_x=-8) $49^{\text {th }}$ International Mathematical Olympiad Spain 2008 Shortlisted Problems with Solutions ## Contents Contributing Countries \& Problem Selection Committee ..... 5 Algebra ..... 7 Problem A1 ..... 7 Problem A2 ..... 9 Problem A3 ..... 11 Problem A4 ..... 12 Problem A5 ..... 14 Problem A6 ..... 15 Problem A7 ..... 17 Combinatorics ..... 21 Problem C1 ..... 21 Problem C2 ..... 23 Problem C3 ..... 24 Problem C4 ..... 25 Problem C5 ..... 26 Problem C6 ..... 27 Geometry ..... 29 Problem G1 ..... 29 Problem G2 ..... 31 Problem G3 ..... 32 Problem G4 ..... 34 Problem G5 ..... 36 Problem G6 ..... 37 Problem G7 ..... 40 Number Theory ..... 43 Problem N1 ..... 43 Problem N2 ..... 45 Problem N3 ..... 46 Problem N4 ..... 47 Problem N5 ..... 49 Problem N6 ..... 50 # Contributing Countries Australia, Austria, Belgium, Bulgaria, Canada, Colombia, Croatia, Czech Republic, Estonia, France, Germany, Greece, Hong Kong, India, Iran, Ireland, Japan, Korea (North), Korea (South), Lithuania, Luxembourg, Mexico, Moldova, Netherlands, Pakistan, Peru, Poland, Romania, Russia, Serbia, Slovakia, South Africa, Sweden, Ukraine, United Kingdom, United States of America ## Problem Selection Committee Vicente Muñoz Velázquez
Juan Manuel Conde Calero
Géza Kós
Marcin Kuczma
Daniel Lasaosa Medarde
Ignasi Mundet i Riera
Svetoslav Savchev ## Algebra A1. Find all functions $f:(0, \infty) \rightarrow(0, \infty)$ such that $$ \frac{f(p)^{2}+f(q)^{2}}{f\left(r^{2}\right)+f\left(s^{2}\right)}=\frac{p^{2}+q^{2}}{r^{2}+s^{2}} $$ for all $p, q, r, s>0$ with $p q=r s$. Solution. Let $f$ satisfy the given condition. Setting $p=q=r=s=1$ yields $f(1)^{2}=f(1)$ and hence $f(1)=1$. Now take any $x>0$ and set $p=x, q=1, r=s=\sqrt{x}$ to obtain $$ \frac{f(x)^{2}+1}{2 f(x)}=\frac{x^{2}+1}{2 x} . $$ This recasts into $$ \begin{gathered} x f(x)^{2}+x=x^{2} f(x)+f(x), \\ (x f(x)-1)(f(x)-x)=0 . \end{gathered} $$ And thus, $$ \text { for every } x>0, \text { either } f(x)=x \text { or } f(x)=\frac{1}{x} \text {. } $$ Obviously, if $$ f(x)=x \quad \text { for all } x>0 \quad \text { or } \quad f(x)=\frac{1}{x} \quad \text { for all } x>0 $$ then the condition of the problem is satisfied. We show that actually these two functions are the only solutions. So let us assume that there exists a function $f$ satisfying the requirement, other than those in (2). Then $f(a) \neq a$ and $f(b) \neq 1 / b$ for some $a, b>0$. By (1), these values must be $f(a)=1 / a, f(b)=b$. Applying now the equation with $p=a, q=b, r=s=\sqrt{a b}$ we obtain $\left(a^{-2}+b^{2}\right) / 2 f(a b)=\left(a^{2}+b^{2}\right) / 2 a b ;$ equivalently, $$ f(a b)=\frac{a b\left(a^{-2}+b^{2}\right)}{a^{2}+b^{2}} . $$ We know however (see (1)) that $f(a b)$ must be either $a b$ or $1 / a b$. If $f(a b)=a b$ then by (3) $a^{-2}+b^{2}=a^{2}+b^{2}$, so that $a=1$. But, as $f(1)=1$, this contradicts the relation $f(a) \neq a$. Likewise, if $f(a b)=1 / a b$ then (3) gives $a^{2} b^{2}\left(a^{-2}+b^{2}\right)=a^{2}+b^{2}$, whence $b=1$, in contradiction to $f(b) \neq 1 / b$. Thus indeed the functions listed in (2) are the only two solutions. Comment. The equation has as many as four variables with only one constraint $p q=r s$, leaving three degrees of freedom and providing a lot of information. Various substitutions force various useful properties of the function searched. We sketch one more method to reach conclusion (1); certainly there are many others. Noticing that $f(1)=1$ and setting, first, $p=q=1, r=\sqrt{x}, s=1 / \sqrt{x}$, and then $p=x, q=1 / x$, $r=s=1$, we obtain two relations, holding for every $x>0$, $$ f(x)+f\left(\frac{1}{x}\right)=x+\frac{1}{x} \quad \text { and } \quad f(x)^{2}+f\left(\frac{1}{x}\right)^{2}=x^{2}+\frac{1}{x^{2}} . $$ Squaring the first and subtracting the second gives $2 f(x) f(1 / x)=2$. Subtracting this from the second relation of (4) leads to $$ \left(f(x)-f\left(\frac{1}{x}\right)\right)^{2}=\left(x-\frac{1}{x}\right)^{2} \quad \text { or } \quad f(x)-f\left(\frac{1}{x}\right)= \pm\left(x-\frac{1}{x}\right) . $$ The last two alternatives combined with the first equation of (4) imply the two alternatives of (1). A2. (a) Prove the inequality $$ \frac{x^{2}}{(x-1)^{2}}+\frac{y^{2}}{(y-1)^{2}}+\frac{z^{2}}{(z-1)^{2}} \geq 1 $$ for real numbers $x, y, z \neq 1$ satisfying the condition $x y z=1$. (b) Show that there are infinitely many triples of rational numbers $x, y, z$ for which this inequality turns into equality. Solution 1. (a) We start with the substitution $$ \frac{x}{x-1}=a, \quad \frac{y}{y-1}=b, \quad \frac{z}{z-1}=c, \quad \text { i.e., } \quad x=\frac{a}{a-1}, \quad y=\frac{b}{b-1}, \quad z=\frac{c}{c-1} \text {. } $$ The inequality to be proved reads $a^{2}+b^{2}+c^{2} \geq 1$. The new variables are subject to the constraints $a, b, c \neq 1$ and the following one coming from the condition $x y z=1$, $$ (a-1)(b-1)(c-1)=a b c . $$ This is successively equivalent to $$ \begin{aligned} a+b+c-1 & =a b+b c+c a, \\ 2(a+b+c-1) & =(a+b+c)^{2}-\left(a^{2}+b^{2}+c^{2}\right), \\ a^{2}+b^{2}+c^{2}-2 & =(a+b+c)^{2}-2(a+b+c), \\ a^{2}+b^{2}+c^{2}-1 & =(a+b+c-1)^{2} . \end{aligned} $$ Thus indeed $a^{2}+b^{2}+c^{2} \geq 1$, as desired. (b) From the equation $a^{2}+b^{2}+c^{2}-1=(a+b+c-1)^{2}$ we see that the proposed inequality becomes an equality if and only if both sums $a^{2}+b^{2}+c^{2}$ and $a+b+c$ have value 1 . The first of them is equal to $(a+b+c)^{2}-2(a b+b c+c a)$. So the instances of equality are described by the system of two equations $$ a+b+c=1, \quad a b+b c+c a=0 $$ plus the constraint $a, b, c \neq 1$. Elimination of $c$ leads to $a^{2}+a b+b^{2}=a+b$, which we regard as a quadratic equation in $b$, $$ b^{2}+(a-1) b+a(a-1)=0, $$ with discriminant $$ \Delta=(a-1)^{2}-4 a(a-1)=(1-a)(1+3 a) . $$ We are looking for rational triples $(a, b, c)$; it will suffice to have $a$ rational such that $1-a$ and $1+3 a$ are both squares of rational numbers (then $\Delta$ will be so too). Set $a=k / m$. We want $m-k$ and $m+3 k$ to be squares of integers. This is achieved for instance by taking $m=k^{2}-k+1$ (clearly nonzero); then $m-k=(k-1)^{2}, m+3 k=(k+1)^{2}$. Note that distinct integers $k$ yield distinct values of $a=k / m$. And thus, if $k$ is any integer and $m=k^{2}-k+1, a=k / m$ then $\Delta=\left(k^{2}-1\right)^{2} / m^{2}$ and the quadratic equation has rational roots $b=\left(m-k \pm k^{2} \mp 1\right) /(2 m)$. Choose e.g. the larger root, $$ b=\frac{m-k+k^{2}-1}{2 m}=\frac{m+(m-2)}{2 m}=\frac{m-1}{m} . $$ Computing $c$ from $a+b+c=1$ then gives $c=(1-k) / m$. The condition $a, b, c \neq 1$ eliminates only $k=0$ and $k=1$. Thus, as $k$ varies over integers greater than 1 , we obtain an infinite family of rational triples $(a, b, c)$ - and coming back to the original variables $(x=a /(a-1)$ etc. $)$-an infinite family of rational triples $(x, y, z)$ with the needed property. (A short calculation shows that the resulting triples are $x=-k /(k-1)^{2}, y=k-k^{2}, z=(k-1) / k^{2}$; but the proof was complete without listing them.) Comment 1. There are many possible variations in handling the equation system $a^{2}+b^{2}+c^{2}=1$, $a+b+c=1(a, b, c \neq 1)$ which of course describes a circle in the $(a, b, c)$-space (with three points excluded), and finding infinitely many rational points on it. Also the initial substitution $x=a /(a-1)$ (etc.) can be successfully replaced by other similar substitutions, e.g. $x=1-1 / \alpha$ (etc.); or $x=x^{\prime}-1$ (etc.); or $1-y z=u$ (etc.) - eventually reducing the inequality to $(\cdots)^{2} \geq 0$, the expression in the parentheses depending on the actual substitution. Depending on the method chosen, one arrives at various sequences of rational triples $(x, y, z)$ as needed; let us produce just one more such example: $x=(2 r-2) /(r+1)^{2}, y=(2 r+2) /(r-1)^{2}$, $z=\left(r^{2}-1\right) / 4$ where $r$ can be any rational number different from 1 or -1 . Solution 2 (an outline). (a) Without changing variables, just setting $z=1 / x y$ and clearing fractions, the proposed inequality takes the form $$ (x y-1)^{2}\left(x^{2}(y-1)^{2}+y^{2}(x-1)^{2}\right)+(x-1)^{2}(y-1)^{2} \geq(x-1)^{2}(y-1)^{2}(x y-1)^{2} . $$ With the notation $p=x+y, q=x y$ this becomes, after lengthy routine manipulation and a lot of cancellation $$ q^{4}-6 q^{3}+2 p q^{2}+9 q^{2}-6 p q+p^{2} \geq 0 \text {. } $$ It is not hard to notice that the expression on the left is just $\left(q^{2}-3 q+p\right)^{2}$, hence nonnegative. (Without introducing $p$ and $q$, one is of course led with some more work to the same expression, just written in terms of $x$ and $y$; but then it is not that easy to see that it is a square.) (b) To have equality, one needs $q^{2}-3 q+p=0$. Note that $x$ and $y$ are the roots of the quadratic trinomial (in a formal variable $t$ ): $t^{2}-p t+q$. When $q^{2}-3 q+p=0$, the discriminant equals $$ \delta=p^{2}-4 q=\left(3 q-q^{2}\right)^{2}-4 q=q(q-1)^{2}(q-4) . $$ Now it suffices to have both $q$ and $q-4$ squares of rational numbers (then $p=3 q-q^{2}$ and $\sqrt{\delta}$ are also rational, and so are the roots of the trinomial). On setting $q=(n / m)^{2}=4+(l / m)^{2}$ the requirement becomes $4 m^{2}+l^{2}=n^{2}$ (with $l, m, n$ being integers). This is just the Pythagorean equation, known to have infinitely many integer solutions. Comment 2. Part (a) alone might also be considered as a possible contest problem (in the category of easy problems). A3. Let $S \subseteq \mathbb{R}$ be a set of real numbers. We say that a pair $(f, g)$ of functions from $S$ into $S$ is a Spanish Couple on $S$, if they satisfy the following conditions: (i) Both functions are strictly increasing, i.e. $f(x)0, C>2$ and $B=1$ produce a Spanish couple (in the example above, $A=1, C=3$ ). The proposer's example results from taking $h(a)=a+1, G(a, b)=3^{a}+b$. A4. For an integer $m$, denote by $t(m)$ the unique number in $\{1,2,3\}$ such that $m+t(m)$ is a multiple of 3. A function $f: \mathbb{Z} \rightarrow \mathbb{Z}$ satisfies $f(-1)=0, f(0)=1, f(1)=-1$ and $$ f\left(2^{n}+m\right)=f\left(2^{n}-t(m)\right)-f(m) \quad \text { for all integers } m, n \geq 0 \text { with } 2^{n}>m \text {. } $$ Prove that $f(3 p) \geq 0$ holds for all integers $p \geq 0$. Solution. The given conditions determine $f$ uniquely on the positive integers. The signs of $f(1), f(2), \ldots$ seem to change quite erratically. However values of the form $f\left(2^{n}-t(m)\right)$ are sufficient to compute directly any functional value. Indeed, let $n>0$ have base 2 representation $n=2^{a_{0}}+2^{a_{1}}+\cdots+2^{a_{k}}, a_{0}>a_{1}>\cdots>a_{k} \geq 0$, and let $n_{j}=2^{a_{j}}+2^{a_{j-1}}+\cdots+2^{a_{k}}, j=0, \ldots, k$. Repeated applications of the recurrence show that $f(n)$ is an alternating sum of the quantities $f\left(2^{a_{j}}-t\left(n_{j+1}\right)\right)$ plus $(-1)^{k+1}$. (The exact formula is not needed for our proof.) So we focus attention on the values $f\left(2^{n}-1\right), f\left(2^{n}-2\right)$ and $f\left(2^{n}-3\right)$. Six cases arise; more specifically, $t\left(2^{2 k}-3\right)=2, t\left(2^{2 k}-2\right)=1, t\left(2^{2 k}-1\right)=3, t\left(2^{2 k+1}-3\right)=1, t\left(2^{2 k+1}-2\right)=3, t\left(2^{2 k+1}-1\right)=2$. Claim. For all integers $k \geq 0$ the following equalities hold: $$ \begin{array}{lll} f\left(2^{2 k+1}-3\right)=0, & f\left(2^{2 k+1}-2\right)=3^{k}, & f\left(2^{2 k+1}-1\right)=-3^{k}, \\ f\left(2^{2 k+2}-3\right)=-3^{k}, & f\left(2^{2 k+2}-2\right)=-3^{k}, & f\left(2^{2 k+2}-1\right)=2 \cdot 3^{k} . \end{array} $$ Proof. By induction on $k$. The base $k=0$ comes down to checking that $f(2)=-1$ and $f(3)=2$; the given values $f(-1)=0, f(0)=1, f(1)=-1$ are also needed. Suppose the claim holds for $k-1$. For $f\left(2^{2 k+1}-t(m)\right)$, the recurrence formula and the induction hypothesis yield $$ \begin{aligned} & f\left(2^{2 k+1}-3\right)=f\left(2^{2 k}+\left(2^{2 k}-3\right)\right)=f\left(2^{2 k}-2\right)-f\left(2^{2 k}-3\right)=-3^{k-1}+3^{k-1}=0, \\ & f\left(2^{2 k+1}-2\right)=f\left(2^{2 k}+\left(2^{2 k}-2\right)\right)=f\left(2^{2 k}-1\right)-f\left(2^{2 k}-2\right)=2 \cdot 3^{k-1}+3^{k-1}=3^{k}, \\ & f\left(2^{2 k+1}-1\right)=f\left(2^{2 k}+\left(2^{2 k}-1\right)\right)=f\left(2^{2 k}-3\right)-f\left(2^{2 k}-1\right)=-3^{k-1}-2 \cdot 3^{k-1}=-3^{k} . \end{aligned} $$ For $f\left(2^{2 k+2}-t(m)\right)$ we use the three equalities just established: $$ \begin{aligned} & f\left(2^{2 k+2}-3\right)=f\left(2^{2 k+1}+\left(2^{2 k+1}-3\right)\right)=f\left(2^{2 k+1}-1\right)-f\left(2^{2 k+1}-3\right)=-3^{k}-0=-3^{k}, \\ & f\left(2^{2 k+2}-2\right)=f\left(2^{2 k+1}+\left(2^{2 k+1}-2\right)\right)=f\left(2^{2 k+1}-3\right)-f\left(2^{2 k}-2\right)=0-3^{k}=-3^{k}, \\ & f\left(2^{2 k+2}-1\right)=f\left(2^{2 k+1}+\left(2^{2 k+1}-1\right)\right)=f\left(2^{2 k+1}-2\right)-f\left(2^{2 k+1}-1\right)=3^{k}+3^{k}=2 \cdot 3^{k} . \end{aligned} $$ The claim follows. A closer look at the six cases shows that $f\left(2^{n}-t(m)\right) \geq 3^{(n-1) / 2}$ if $2^{n}-t(m)$ is divisible by 3 , and $f\left(2^{n}-t(m)\right) \leq 0$ otherwise. On the other hand, note that $2^{n}-t(m)$ is divisible by 3 if and only if $2^{n}+m$ is. Therefore, for all nonnegative integers $m$ and $n$, (i) $f\left(2^{n}-t(m)\right) \geq 3^{(n-1) / 2}$ if $2^{n}+m$ is divisible by 3 ; (ii) $f\left(2^{n}-t(m)\right) \leq 0$ if $2^{n}+m$ is not divisible by 3 . One more (direct) consequence of the claim is that $\left|f\left(2^{n}-t(m)\right)\right| \leq \frac{2}{3} \cdot 3^{n / 2}$ for all $m, n \geq 0$. The last inequality enables us to find an upper bound for $|f(m)|$ for $m$ less than a given power of 2 . We prove by induction on $n$ that $|f(m)| \leq 3^{n / 2}$ holds true for all integers $m, n \geq 0$ with $2^{n}>m$. The base $n=0$ is clear as $f(0)=1$. For the inductive step from $n$ to $n+1$, let $m$ and $n$ satisfy $2^{n+1}>m$. If $m<2^{n}$, we are done by the inductive hypothesis. If $m \geq 2^{n}$ then $m=2^{n}+k$ where $2^{n}>k \geq 0$. Now, by $\left|f\left(2^{n}-t(k)\right)\right| \leq \frac{2}{3} \cdot 3^{n / 2}$ and the inductive assumption, $$ |f(m)|=\left|f\left(2^{n}-t(k)\right)-f(k)\right| \leq\left|f\left(2^{n}-t(k)\right)\right|+|f(k)| \leq \frac{2}{3} \cdot 3^{n / 2}+3^{n / 2}<3^{(n+1) / 2} . $$ The induction is complete. We proceed to prove that $f(3 p) \geq 0$ for all integers $p \geq 0$. Since $3 p$ is not a power of 2 , its binary expansion contains at least two summands. Hence one can write $3 p=2^{a}+2^{b}+c$ where $a>b$ and $2^{b}>c \geq 0$. Applying the recurrence formula twice yields $$ f(3 p)=f\left(2^{a}+2^{b}+c\right)=f\left(2^{a}-t\left(2^{b}+c\right)\right)-f\left(2^{b}-t(c)\right)+f(c) . $$ Since $2^{a}+2^{b}+c$ is divisible by 3 , we have $f\left(2^{a}-t\left(2^{b}+c\right)\right) \geq 3^{(a-1) / 2}$ by (i). Since $2^{b}+c$ is not divisible by 3 , we have $f\left(2^{b}-t(c)\right) \leq 0$ by (ii). Finally $|f(c)| \leq 3^{b / 2}$ as $2^{b}>c \geq 0$, so that $f(c) \geq-3^{b / 2}$. Therefore $f(3 p) \geq 3^{(a-1) / 2}-3^{b / 2}$ which is nonnegative because $a>b$. A5. Let $a, b, c, d$ be positive real numbers such that $$ a b c d=1 \quad \text { and } \quad a+b+c+d>\frac{a}{b}+\frac{b}{c}+\frac{c}{d}+\frac{d}{a} $$ Prove that $$ a+b+c+d<\frac{b}{a}+\frac{c}{b}+\frac{d}{c}+\frac{a}{d} $$ Solution. We show that if $a b c d=1$, the sum $a+b+c+d$ cannot exceed a certain weighted mean of the expressions $\frac{a}{b}+\frac{b}{c}+\frac{c}{d}+\frac{d}{a}$ and $\frac{b}{a}+\frac{c}{b}+\frac{d}{c}+\frac{a}{d}$. By applying the AM-GM inequality to the numbers $\frac{a}{b}, \frac{a}{b}, \frac{b}{c}$ and $\frac{a}{d}$, we obtain $$ a=\sqrt[4]{\frac{a^{4}}{a b c d}}=\sqrt[4]{\frac{a}{b} \cdot \frac{a}{b} \cdot \frac{b}{c} \cdot \frac{a}{d}} \leq \frac{1}{4}\left(\frac{a}{b}+\frac{a}{b}+\frac{b}{c}+\frac{a}{d}\right) $$ Analogously, $$ b \leq \frac{1}{4}\left(\frac{b}{c}+\frac{b}{c}+\frac{c}{d}+\frac{b}{a}\right), \quad c \leq \frac{1}{4}\left(\frac{c}{d}+\frac{c}{d}+\frac{d}{a}+\frac{c}{b}\right) \quad \text { and } \quad d \leq \frac{1}{4}\left(\frac{d}{a}+\frac{d}{a}+\frac{a}{b}+\frac{d}{c}\right) . $$ Summing up these estimates yields $$ a+b+c+d \leq \frac{3}{4}\left(\frac{a}{b}+\frac{b}{c}+\frac{c}{d}+\frac{d}{a}\right)+\frac{1}{4}\left(\frac{b}{a}+\frac{c}{b}+\frac{d}{c}+\frac{a}{d}\right) . $$ In particular, if $a+b+c+d>\frac{a}{b}+\frac{b}{c}+\frac{c}{d}+\frac{d}{a}$ then $a+b+c+d<\frac{b}{a}+\frac{c}{b}+\frac{d}{c}+\frac{a}{d}$. Comment. The estimate in the above solution was obtained by applying the AM-GM inequality to each column of the $4 \times 4$ array $$ \begin{array}{llll} a / b & b / c & c / d & d / a \\ a / b & b / c & c / d & d / a \\ b / c & c / d & d / a & a / b \\ a / d & b / a & c / b & d / c \end{array} $$ and adding up the resulting inequalities. The same table yields a stronger bound: If $a, b, c, d>0$ and $a b c d=1$ then $$ \left(\frac{a}{b}+\frac{b}{c}+\frac{c}{d}+\frac{d}{a}\right)^{3}\left(\frac{b}{a}+\frac{c}{b}+\frac{d}{c}+\frac{a}{d}\right) \geq(a+b+c+d)^{4} $$ It suffices to apply Hölder's inequality to the sequences in the four rows, with weights $1 / 4$ : $$ \begin{gathered} \left(\frac{a}{b}+\frac{b}{c}+\frac{c}{d}+\frac{d}{a}\right)^{1 / 4}\left(\frac{a}{b}+\frac{b}{c}+\frac{c}{d}+\frac{d}{a}\right)^{1 / 4}\left(\frac{b}{c}+\frac{c}{d}+\frac{d}{a}+\frac{a}{b}\right)^{1 / 4}\left(\frac{a}{d}+\frac{b}{a}+\frac{c}{b}+\frac{d}{c}\right)^{1 / 4} \\ \geq\left(\frac{a a b a}{b b c d}\right)^{1 / 4}+\left(\frac{b b c b}{c c d a}\right)^{1 / 4}+\left(\frac{c c d c}{d d a b}\right)^{1 / 4}+\left(\frac{d d a d}{a a b c}\right)^{1 / 4}=a+b+c+d \end{gathered} $$ A6. Let $f: \mathbb{R} \rightarrow \mathbb{N}$ be a function which satisfies $$ f\left(x+\frac{1}{f(y)}\right)=f\left(y+\frac{1}{f(x)}\right) \quad \text { for all } x, y \in \mathbb{R} . $$ Prove that there is a positive integer which is not a value of $f$. Solution. Suppose that the statement is false and $f(\mathbb{R})=\mathbb{N}$. We prove several properties of the function $f$ in order to reach a contradiction. To start with, observe that one can assume $f(0)=1$. Indeed, let $a \in \mathbb{R}$ be such that $f(a)=1$, and consider the function $g(x)=f(x+a)$. By substituting $x+a$ and $y+a$ for $x$ and $y$ in (1), we have $$ g\left(x+\frac{1}{g(y)}\right)=f\left(x+a+\frac{1}{f(y+a)}\right)=f\left(y+a+\frac{1}{f(x+a)}\right)=g\left(y+\frac{1}{g(x)}\right) . $$ So $g$ satisfies the functional equation (1), with the additional property $g(0)=1$. Also, $g$ and $f$ have the same set of values: $g(\mathbb{R})=f(\mathbb{R})=\mathbb{N}$. Henceforth we assume $f(0)=1$. Claim 1. For an arbitrary fixed $c \in \mathbb{R}$ we have $\left\{f\left(c+\frac{1}{n}\right): n \in \mathbb{N}\right\}=\mathbb{N}$. Proof. Equation (1) and $f(\mathbb{R})=\mathbb{N}$ imply $f(\mathbb{R})=\left\{f\left(x+\frac{1}{f(c)}\right): x \in \mathbb{R}\right\}=\left\{f\left(c+\frac{1}{f(x)}\right): x \in \mathbb{R}\right\} \subset\left\{f\left(c+\frac{1}{n}\right): n \in \mathbb{N}\right\} \subset f(\mathbb{R})$. The claim follows. We will use Claim 1 in the special cases $c=0$ and $c=1 / 3$ : $$ \left\{f\left(\frac{1}{n}\right): n \in \mathbb{N}\right\}=\left\{f\left(\frac{1}{3}+\frac{1}{n}\right): n \in \mathbb{N}\right\}=\mathbb{N} $$ Claim 2. If $f(u)=f(v)$ for some $u, v \in \mathbb{R}$ then $f(u+q)=f(v+q)$ for all nonnegative rational $q$. Furthermore, if $f(q)=1$ for some nonnegative rational $q$ then $f(k q)=1$ for all $k \in \mathbb{N}$. Proof. For all $x \in \mathbb{R}$ we have by (1) $$ f\left(u+\frac{1}{f(x)}\right)=f\left(x+\frac{1}{f(u)}\right)=f\left(x+\frac{1}{f(v)}\right)=f\left(v+\frac{1}{f(x)}\right) $$ Since $f(x)$ attains all positive integer values, this yields $f(u+1 / n)=f(v+1 / n)$ for all $n \in \mathbb{N}$. Let $q=k / n$ be a positive rational number. Then $k$ repetitions of the last step yield $$ f(u+q)=f\left(u+\frac{k}{n}\right)=f\left(v+\frac{k}{n}\right)=f(v+q) $$ Now let $f(q)=1$ for some nonnegative rational $q$, and let $k \in \mathbb{N}$. As $f(0)=1$, the previous conclusion yields successively $f(q)=f(2 q), f(2 q)=f(3 q), \ldots, f((k-1) q)=f(k q)$, as needed. Claim 3. The equality $f(q)=f(q+1)$ holds for all nonnegative rational $q$. Proof. Let $m$ be a positive integer such that $f(1 / m)=1$. Such an $m$ exists by (2). Applying the second statement of Claim 2 with $q=1 / m$ and $k=m$ yields $f(1)=1$. Given that $f(0)=f(1)=1$, the first statement of Claim 2 implies $f(q)=f(q+1)$ for all nonnegative rational $q$. Claim 4. The equality $f\left(\frac{1}{n}\right)=n$ holds for every $n \in \mathbb{N}$. Proof. For a nonnegative rational $q$ we set $x=q, y=0$ in (1) and use Claim 3 to obtain $$ f\left(\frac{1}{f(q)}\right)=f\left(q+\frac{1}{f(0)}\right)=f(q+1)=f(q) . $$ By (2), for each $n \in \mathbb{N}$ there exists a $k \in \mathbb{N}$ such that $f(1 / k)=n$. Applying the last equation with $q=1 / k$, we have $$ n=f\left(\frac{1}{k}\right)=f\left(\frac{1}{f(1 / k)}\right)=f\left(\frac{1}{n}\right) $$ Now we are ready to obtain a contradiction. Let $n \in \mathbb{N}$ be such that $f(1 / 3+1 / n)=1$. Such an $n$ exists by (2). Let $1 / 3+1 / n=s / t$, where $s, t \in \mathbb{N}$ are coprime. Observe that $t>1$ as $1 / 3+1 / n$ is not an integer. Choose $k, l \in \mathbb{N}$ so that that $k s-l t=1$. Because $f(0)=f(s / t)=1$, Claim 2 implies $f(k s / t)=1$. Now $f(k s / t)=f(1 / t+l)$; on the other hand $f(1 / t+l)=f(1 / t)$ by $l$ successive applications of Claim 3 . Finally, $f(1 / t)=t$ by Claim 4, leading to the impossible $t=1$. The solution is complete. A7. Prove that for any four positive real numbers $a, b, c, d$ the inequality $$ \frac{(a-b)(a-c)}{a+b+c}+\frac{(b-c)(b-d)}{b+c+d}+\frac{(c-d)(c-a)}{c+d+a}+\frac{(d-a)(d-b)}{d+a+b} \geq 0 $$ holds. Determine all cases of equality. Solution 1. Denote the four terms by $$ A=\frac{(a-b)(a-c)}{a+b+c}, \quad B=\frac{(b-c)(b-d)}{b+c+d}, \quad C=\frac{(c-d)(c-a)}{c+d+a}, \quad D=\frac{(d-a)(d-b)}{d+a+b} . $$ The expression $2 A$ splits into two summands as follows, $$ 2 A=A^{\prime}+A^{\prime \prime} \quad \text { where } \quad A^{\prime}=\frac{(a-c)^{2}}{a+b+c}, \quad A^{\prime \prime}=\frac{(a-c)(a-2 b+c)}{a+b+c} ; $$ this is easily verified. We analogously represent $2 B=B^{\prime}+B^{\prime \prime}, 2 C=C^{\prime}+C^{\prime \prime}, 2 B=D^{\prime}+D^{\prime \prime}$ and examine each of the sums $A^{\prime}+B^{\prime}+C^{\prime}+D^{\prime}$ and $A^{\prime \prime}+B^{\prime \prime}+C^{\prime \prime}+D^{\prime \prime}$ separately. Write $s=a+b+c+d$; the denominators become $s-d, s-a, s-b, s-c$. By the CauchySchwarz inequality, $$ \begin{aligned} & \left(\frac{|a-c|}{\sqrt{s-d}} \cdot \sqrt{s-d}+\frac{|b-d|}{\sqrt{s-a}} \cdot \sqrt{s-a}+\frac{|c-a|}{\sqrt{s-b}} \cdot \sqrt{s-b}+\frac{|d-b|}{\sqrt{s-c}} \cdot \sqrt{s-c}\right)^{2} \\ & \quad \leq\left(\frac{(a-c)^{2}}{s-d}+\frac{(b-d)^{2}}{s-a}+\frac{(c-a)^{2}}{s-b}+\frac{(d-b)^{2}}{s-c}\right)(4 s-s)=3 s\left(A^{\prime}+B^{\prime}+C^{\prime}+D^{\prime}\right) . \end{aligned} $$ Hence $$ A^{\prime}+B^{\prime}+C^{\prime}+D^{\prime} \geq \frac{(2|a-c|+2|b-d|)^{2}}{3 s} \geq \frac{16 \cdot|a-c| \cdot|b-d|}{3 s} . $$ Next we estimate the absolute value of the other sum. We couple $A^{\prime \prime}$ with $C^{\prime \prime}$ to obtain $$ \begin{aligned} A^{\prime \prime}+C^{\prime \prime} & =\frac{(a-c)(a+c-2 b)}{s-d}+\frac{(c-a)(c+a-2 d)}{s-b} \\ & =\frac{(a-c)(a+c-2 b)(s-b)+(c-a)(c+a-2 d)(s-d)}{(s-d)(s-b)} \\ & =\frac{(a-c)(-2 b(s-b)-b(a+c)+2 d(s-d)+d(a+c))}{s(a+c)+b d} \\ & =\frac{3(a-c)(d-b)(a+c)}{M}, \quad \text { with } \quad M=s(a+c)+b d . \end{aligned} $$ Hence by cyclic shift $$ B^{\prime \prime}+D^{\prime \prime}=\frac{3(b-d)(a-c)(b+d)}{N}, \quad \text { with } \quad N=s(b+d)+c a $$ Thus $$ A^{\prime \prime}+B^{\prime \prime}+C^{\prime \prime}+D^{\prime \prime}=3(a-c)(b-d)\left(\frac{b+d}{N}-\frac{a+c}{M}\right)=\frac{3(a-c)(b-d) W}{M N} $$ where $$ W=(b+d) M-(a+c) N=b d(b+d)-a c(a+c) . $$ Note that $$ M N>(a c(a+c)+b d(b+d)) s \geq|W| \cdot s . $$ Now (2) and (4) yield $$ \left|A^{\prime \prime}+B^{\prime \prime}+C^{\prime \prime}+D^{\prime \prime}\right| \leq \frac{3 \cdot|a-c| \cdot|b-d|}{s} $$ Combined with (1) this results in $$ \begin{aligned} 2(A+B & +C+D)=\left(A^{\prime}+B^{\prime}+C^{\prime}+D^{\prime}\right)+\left(A^{\prime \prime}+B^{\prime \prime}+C^{\prime \prime}+D^{\prime \prime}\right) \\ & \geq \frac{16 \cdot|a-c| \cdot|b-d|}{3 s}-\frac{3 \cdot|a-c| \cdot|b-d|}{s}=\frac{7 \cdot|a-c| \cdot|b-d|}{3(a+b+c+d)} \geq 0 \end{aligned} $$ This is the required inequality. From the last line we see that equality can be achieved only if either $a=c$ or $b=d$. Since we also need equality in (1), this implies that actually $a=c$ and $b=d$ must hold simultaneously, which is obviously also a sufficient condition. Solution 2. We keep the notations $A, B, C, D, s$, and also $M, N, W$ from the preceding solution; the definitions of $M, N, W$ and relations (3), (4) in that solution did not depend on the foregoing considerations. Starting from $$ 2 A=\frac{(a-c)^{2}+3(a+c)(a-c)}{a+b+c}-2 a+2 c $$ we get $$ \begin{aligned} 2(A & +C)=(a-c)^{2}\left(\frac{1}{s-d}+\frac{1}{s-b}\right)+3(a+c)(a-c)\left(\frac{1}{s-d}-\frac{1}{s-b}\right) \\ & =(a-c)^{2} \frac{2 s-b-d}{M}+3(a+c)(a-c) \cdot \frac{d-b}{M}=\frac{p(a-c)^{2}-3(a+c)(a-c)(b-d)}{M} \end{aligned} $$ where $p=2 s-b-d=s+a+c$. Similarly, writing $q=s+b+d$ we have $$ 2(B+D)=\frac{q(b-d)^{2}-3(b+d)(b-d)(c-a)}{N} ; $$ specific grouping of terms in the numerators has its aim. Note that $p q>2 s^{2}$. By adding the fractions expressing $2(A+C)$ and $2(B+D)$, $$ 2(A+B+C+D)=\frac{p(a-c)^{2}}{M}+\frac{3(a-c)(b-d) W}{M N}+\frac{q(b-d)^{2}}{N} $$ with $W$ defined by (3). Substitution $x=(a-c) / M, y=(b-d) / N$ brings the required inequality to the form $$ 2(A+B+C+D)=M p x^{2}+3 W x y+N q y^{2} \geq 0 . $$ It will be enough to verify that the discriminant $\Delta=9 W^{2}-4 M N p q$ of the quadratic trinomial $M p t^{2}+3 W t+N q$ is negative; on setting $t=x / y$ one then gets (6). The first inequality in (4) together with $p q>2 s^{2}$ imply $4 M N p q>8 s^{3}(a c(a+c)+b d(b+d))$. Since $$ (a+c) s^{3}>(a+c)^{4} \geq 4 a c(a+c)^{2} \quad \text { and likewise } \quad(b+d) s^{3}>4 b d(b+d)^{2} $$ the estimate continues as follows, $$ 4 M N p q>8\left(4(a c)^{2}(a+c)^{2}+4(b d)^{2}(b+d)^{2}\right)>32(b d(b+d)-a c(a+c))^{2}=32 W^{2} \geq 9 W^{2} $$ Thus indeed $\Delta<0$. The desired inequality (6) hence results. It becomes an equality if and only if $x=y=0$; equivalently, if and only if $a=c$ and simultaneously $b=d$. Comment. The two solutions presented above do not differ significantly; large portions overlap. The properties of the number $W$ turn out to be crucial in both approaches. The Cauchy-Schwarz inequality, applied in the first solution, is avoided in the second, which requires no knowledge beyond quadratic trinomials. The estimates in the proof of $\Delta<0$ in the second solution seem to be very wasteful. However, they come close to sharp when the terms in one of the pairs $(a, c),(b, d)$ are equal and much bigger than those in the other pair. In attempts to prove the inequality by just considering the six cases of arrangement of the numbers $a, b, c, d$ on the real line, one soon discovers that the cases which create real trouble are precisely those in which $a$ and $c$ are both greater or both smaller than $b$ and $d$. ## Solution 3. $$ \begin{gathered} (a-b)(a-c)(a+b+d)(a+c+d)(b+c+d)= \\ =((a-b)(a+b+d))((a-c)(a+c+d))(b+c+d)= \\ =\left(a^{2}+a d-b^{2}-b d\right)\left(a^{2}+a d-c^{2}-c d\right)(b+c+d)= \\ =\left(a^{4}+2 a^{3} d-a^{2} b^{2}-a^{2} b d-a^{2} c^{2}-a^{2} c d+a^{2} d^{2}-a b^{2} d-a b d^{2}-a c^{2} d-a c d^{2}+b^{2} c^{2}+b^{2} c d+b c^{2} d+b c d^{2}\right)(b+c+d)= \\ =a^{4} b+a^{4} c+a^{4} d+\left(b^{3} c^{2}+a^{2} d^{3}\right)-a^{2} c^{3}+\left(2 a^{3} d^{2}-b^{3} a^{2}+c^{3} b^{2}\right)+ \\ +\left(b^{3} c d-c^{3} d a-d^{3} a b\right)+\left(2 a^{3} b d+c^{3} d b-d^{3} a c\right)+\left(2 a^{3} c d-b^{3} d a+d^{3} b c\right) \\ +\left(-a^{2} b^{2} c+3 b^{2} c^{2} d-2 a c^{2} d^{2}\right)+\left(-2 a^{2} b^{2} d+2 b c^{2} d^{2}\right)+\left(-a^{2} b c^{2}-2 a^{2} c^{2} d-2 a b^{2} d^{2}+2 b^{2} c d^{2}\right)+ \\ +\left(-2 a^{2} b c d-a b^{2} c d-a b c^{2} d-2 a b c d^{2}\right) \\ \text { Introducing the notation } S_{x y z w}=\sum_{c y c} a^{x} b^{y} c^{z} d^{w}, \text { one can write } \\ \sum_{c y c}(a-b)(a-c)(a+b+d)(a+c+d)(b+c+d)= \\ =S_{4100}+S_{4010}+S_{4001}+2 S_{3200}-S_{3020}+2 S_{3002}-S_{3110}+2 S_{3101}+2 S_{3011}-3 S_{2120}-6 S_{2111}= \\ +\left(S_{4100}+S_{4001}+\frac{1}{2} S_{3110}+\frac{1}{2} S_{3011}-3 S_{2120}\right)+ \\ +\left(S_{4010}-S_{3020}-\frac{3}{2} S_{3110}+\frac{3}{2} S_{3011}+\frac{9}{16} S_{2210}+\frac{9}{16} S_{2201}-\frac{9}{8} S_{2111}\right)+ \\ +\frac{9}{16}\left(S_{3200}-S_{2210}-S_{2201}+S_{3002}\right)+\frac{23}{16}\left(S_{3200}-2 S_{3101}+S_{3002}\right)+\frac{39}{8}\left(S_{3101}-S_{2111}\right), \end{gathered} $$ where the expressions $$ \begin{gathered} S_{4100}+S_{4001}+\frac{1}{2} S_{3110}+\frac{1}{2} S_{3011}-3 S_{2120}=\sum_{c y c}\left(a^{4} b+b c^{4}+\frac{1}{2} a^{3} b c+\frac{1}{2} a b c^{3}-3 a^{2} b c^{2}\right), \\ S_{4010}-S_{3020}-\frac{3}{2} S_{3110}+\frac{3}{2} S_{3011}+\frac{9}{16} S_{2210}+\frac{9}{16} S_{2201}-\frac{9}{8} S_{2111}=\sum_{c y c} a^{2} c\left(a-c-\frac{3}{4} b+\frac{3}{4} d\right)^{2}, \\ S_{3200}-S_{2210}-S_{2201}+S_{3002}=\sum_{c y c} b^{2}\left(a^{3}-a^{2} c-a c^{2}+c^{3}\right)=\sum_{c y c} b^{2}(a+c)(a-c)^{2}, \\ S_{3200}-2 S_{3101}+S_{3002}=\sum_{c y c} a^{3}(b-d)^{2} \quad \text { and } \quad S_{3101}-S_{2111}=\frac{1}{3} \sum_{c y c} b d\left(2 a^{3}+c^{3}-3 a^{2} c\right) \end{gathered} $$ are all nonnegative. ## Combinatorics C1. In the plane we consider rectangles whose sides are parallel to the coordinate axes and have positive length. Such a rectangle will be called a box. Two boxes intersect if they have a common point in their interior or on their boundary. Find the largest $n$ for which there exist $n$ boxes $B_{1}, \ldots, B_{n}$ such that $B_{i}$ and $B_{j}$ intersect if and only if $i \not \equiv j \pm 1(\bmod n)$. Solution. The maximum number of such boxes is 6 . One example is shown in the figure. ![](https://cdn.mathpix.com/cropped/2024_04_17_e32cef0f3c5b05a0a6b1g-22.jpg?height=437&width=457&top_left_y=1135&top_left_x=777) Now we show that 6 is the maximum. Suppose that boxes $B_{1}, \ldots, B_{n}$ satisfy the condition. Let the closed intervals $I_{k}$ and $J_{k}$ be the projections of $B_{k}$ onto the $x$ - and $y$-axis, for $1 \leq k \leq n$. If $B_{i}$ and $B_{j}$ intersect, with a common point $(x, y)$, then $x \in I_{i} \cap I_{j}$ and $y \in J_{i} \cap J_{j}$. So the intersections $I_{i} \cap I_{j}$ and $J_{i} \cap J_{j}$ are nonempty. Conversely, if $x \in I_{i} \cap I_{j}$ and $y \in J_{i} \cap J_{j}$ for some real numbers $x, y$, then $(x, y)$ is a common point of $B_{i}$ and $B_{j}$. Putting it around, $B_{i}$ and $B_{j}$ are disjoint if and only if their projections on at least one coordinate axis are disjoint. For brevity we call two boxes or intervals adjacent if their indices differ by 1 modulo $n$, and nonadjacent otherwise. The adjacent boxes $B_{k}$ and $B_{k+1}$ do not intersect for each $k=1, \ldots, n$. Hence $\left(I_{k}, I_{k+1}\right)$ or $\left(J_{k}, J_{k+1}\right)$ is a pair of disjoint intervals, $1 \leq k \leq n$. So there are at least $n$ pairs of disjoint intervals among $\left(I_{1}, I_{2}\right), \ldots,\left(I_{n-1}, I_{n}\right),\left(I_{n}, I_{1}\right) ;\left(J_{1}, J_{2}\right), \ldots,\left(J_{n-1}, J_{n}\right),\left(J_{n}, J_{1}\right)$. Next, every two nonadjacent boxes intersect, hence their projections on both axes intersect, too. Then the claim below shows that at most 3 pairs among $\left(I_{1}, I_{2}\right), \ldots,\left(I_{n-1}, I_{n}\right),\left(I_{n}, I_{1}\right)$ are disjoint, and the same holds for $\left(J_{1}, J_{2}\right) \ldots,\left(J_{n-1}, J_{n}\right),\left(J_{n}, J_{1}\right)$. Consequently $n \leq 3+3=6$, as stated. Thus we are left with the claim and its justification. Claim. Let $\Delta_{1}, \Delta_{2}, \ldots, \Delta_{n}$ be intervals on a straight line such that every two nonadjacent intervals intersect. Then $\Delta_{k}$ and $\Delta_{k+1}$ are disjoint for at most three values of $k=1, \ldots, n$. Proof. Denote $\Delta_{k}=\left[a_{k}, b_{k}\right], 1 \leq k \leq n$. Let $\alpha=\max \left(a_{1}, \ldots, a_{n}\right)$ be the rightmost among the left endpoints of $\Delta_{1}, \ldots, \Delta_{n}$, and let $\beta=\min \left(b_{1}, \ldots, b_{n}\right)$ be the leftmost among their right endpoints. Assume that $\alpha=a_{2}$ without loss of generality. If $\alpha \leq \beta$ then $a_{i} \leq \alpha \leq \beta \leq b_{i}$ for all $i$. Every $\Delta_{i}$ contains $\alpha$, and thus no disjoint pair $\left(\Delta_{i}, \Delta_{i+1}\right)$ exists. If $\beta<\alpha$ then $\beta=b_{i}$ for some $i$ such that $a_{i}3$ and consider any nice permutation $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ of $\{1,2, \ldots, n\}$. Then $n-1$ must be a divisor of the number $$ \begin{aligned} & 2\left(a_{1}+a_{2}+\cdots+a_{n-1}\right)=2\left((1+2+\cdots+n)-a_{n}\right) \\ & \quad=n(n+1)-2 a_{n}=(n+2)(n-1)+\left(2-2 a_{n}\right) . \end{aligned} $$ So $2 a_{n}-2$ must be divisible by $n-1$, hence equal to 0 or $n-1$ or $2 n-2$. This means that $$ a_{n}=1 \quad \text { or } \quad a_{n}=\frac{n+1}{2} \quad \text { or } \quad a_{n}=n \text {. } $$ Suppose that $a_{n}=(n+1) / 2$. Since the permutation is nice, taking $k=n-2$ we get that $n-2$ has to be a divisor of $$ \begin{aligned} 2\left(a_{1}+a_{2}+\cdots+a_{n-2}\right) & =2\left((1+2+\cdots+n)-a_{n}-a_{n-1}\right) \\ & =n(n+1)-(n+1)-2 a_{n-1}=(n+2)(n-2)+\left(3-2 a_{n-1}\right) . \end{aligned} $$ So $2 a_{n-1}-3$ should be divisible by $n-2$, hence equal to 0 or $n-2$ or $2 n-4$. Obviously 0 and $2 n-4$ are excluded because $2 a_{n-1}-3$ is odd. The remaining possibility $\left(2 a_{n-1}-3=n-2\right)$ leads to $a_{n-1}=(n+1) / 2=a_{n}$, which also cannot hold. This eliminates $(n+1) / 2$ as a possible value of $a_{n}$. Consequently $a_{n}=1$ or $a_{n}=n$. If $a_{n}=n$ then $\left(a_{1}, a_{2}, \ldots, a_{n-1}\right)$ is a nice permutation of $\{1,2, \ldots, n-1\}$. There are $F_{n-1}$ such permutations. Attaching $n$ to any one of them at the end creates a nice permutation of $\{1,2, \ldots, n\}$. If $a_{n}=1$ then $\left(a_{1}-1, a_{2}-1, \ldots, a_{n-1}-1\right)$ is a permutation of $\{1,2, \ldots, n-1\}$. It is also nice because the number $$ 2\left(\left(a_{1}-1\right)+\cdots+\left(a_{k}-1\right)\right)=2\left(a_{1}+\cdots+a_{k}\right)-2 k $$ is divisible by $k$, for any $k \leq n-1$. And again, any one of the $F_{n-1}$ nice permutations $\left(b_{1}, b_{2}, \ldots, b_{n-1}\right)$ of $\{1,2, \ldots, n-1\}$ gives rise to a nice permutation of $\{1,2, \ldots, n\}$ whose last term is 1 , namely $\left(b_{1}+1, b_{2}+1, \ldots, b_{n-1}+1,1\right)$. The bijective correspondences established in both cases show that there are $F_{n-1}$ nice permutations of $\{1,2, \ldots, n\}$ with the last term 1 and also $F_{n-1}$ nice permutations of $\{1,2, \ldots, n\}$ with the last term $n$. Hence follows the recurrence $F_{n}=2 F_{n-1}$. With the base value $F_{3}=6$ this gives the outcome formula $F_{n}=3 \cdot 2^{n-2}$ for $n \geq 3$. C3. In the coordinate plane consider the set $S$ of all points with integer coordinates. For a positive integer $k$, two distinct points $A, B \in S$ will be called $k$-friends if there is a point $C \in S$ such that the area of the triangle $A B C$ is equal to $k$. A set $T \subset S$ will be called a $k$-clique if every two points in $T$ are $k$-friends. Find the least positive integer $k$ for which there exists a $k$-clique with more than 200 elements. Solution. To begin, let us describe those points $B \in S$ which are $k$-friends of the point $(0,0)$. By definition, $B=(u, v)$ satisfies this condition if and only if there is a point $C=(x, y) \in S$ such that $\frac{1}{2}|u y-v x|=k$. (This is a well-known formula expressing the area of triangle $A B C$ when $A$ is the origin.) To say that there exist integers $x, y$ for which $|u y-v x|=2 k$, is equivalent to saying that the greatest common divisor of $u$ and $v$ is also a divisor of $2 k$. Summing up, a point $B=(u, v) \in S$ is a $k$-friend of $(0,0)$ if and only if $\operatorname{gcd}(u, v)$ divides $2 k$. Translation by a vector with integer coordinates does not affect $k$-friendship; if two points are $k$-friends, so are their translates. It follows that two points $A, B \in S, A=(s, t), B=(u, v)$, are $k$-friends if and only if the point $(u-s, v-t)$ is a $k$-friend of $(0,0)$; i.e., if $\operatorname{gcd}(u-s, v-t) \mid 2 k$. Let $n$ be a positive integer which does not divide $2 k$. We claim that a $k$-clique cannot have more than $n^{2}$ elements. Indeed, all points $(x, y) \in S$ can be divided into $n^{2}$ classes determined by the remainders that $x$ and $y$ leave in division by $n$. If a set $T$ has more than $n^{2}$ elements, some two points $A, B \in T, A=(s, t), B=(u, v)$, necessarily fall into the same class. This means that $n \mid u-s$ and $n \mid v-t$. Hence $n \mid d$ where $d=\operatorname{gcd}(u-s, v-t)$. And since $n$ does not divide $2 k$, also $d$ does not divide $2 k$. Thus $A$ and $B$ are not $k$-friends and the set $T$ is not a $k$-clique. Now let $M(k)$ be the least positive integer which does not divide $2 k$. Write $M(k)=m$ for the moment and consider the set $T$ of all points $(x, y)$ with $0 \leq x, y200$. By the definition of $M(k), 2 k$ is divisible by the numbers $1,2, \ldots, M(k)-1$, but not by $M(k)$ itself. If $M(k)^{2}>200$ then $M(k) \geq 15$. Trying to hit $M(k)=15$ we get a contradiction immediately ( $2 k$ would have to be divisible by 3 and 5 , but not by 15 ). So let us try $M(k)=16$. Then $2 k$ is divisible by the numbers $1,2, \ldots, 15$, hence also by their least common multiple $L$, but not by 16 . And since $L$ is not a multiple of 16 , we infer that $k=L / 2$ is the least $k$ with $M(k)=16$. Finally, observe that if $M(k) \geq 17$ then $2 k$ must be divisible by the least common multiple of $1,2, \ldots, 16$, which is equal to $2 L$. Then $2 k \geq 2 L$, yielding $k>L / 2$. In conclusion, the least $k$ with the required property is equal to $L / 2=180180$. C4. Let $n$ and $k$ be fixed positive integers of the same parity, $k \geq n$. We are given $2 n$ lamps numbered 1 through $2 n$; each of them can be on or off. At the beginning all lamps are off. We consider sequences of $k$ steps. At each step one of the lamps is switched (from off to on or from on to off). Let $N$ be the number of $k$-step sequences ending in the state: lamps $1, \ldots, n$ on, lamps $n+1, \ldots, 2 n$ off. Let $M$ be the number of $k$-step sequences leading to the same state and not touching lamps $n+1, \ldots, 2 n$ at all. Find the ratio $N / M$. Solution. A sequence of $k$ switches ending in the state as described in the problem statement (lamps $1, \ldots, n$ on, lamps $n+1, \ldots, 2 n$ off) will be called an admissible process. If, moreover, the process does not touch the lamps $n+1, \ldots, 2 n$, it will be called restricted. So there are $N$ admissible processes, among which $M$ are restricted. In every admissible process, restricted or not, each one of the lamps $1, \ldots, n$ goes from off to on, so it is switched an odd number of times; and each one of the lamps $n+1, \ldots, 2 n$ goes from off to off, so it is switched an even number of times. Notice that $M>0$; i.e., restricted admissible processes do exist (it suffices to switch each one of the lamps $1, \ldots, n$ just once and then choose one of them and switch it $k-n$ times, which by hypothesis is an even number). Consider any restricted admissible process $\mathbf{p}$. Take any lamp $\ell, 1 \leq \ell \leq n$, and suppose that it was switched $k_{\ell}$ times. As noticed, $k_{\ell}$ must be odd. Select arbitrarily an even number of these $k_{\ell}$ switches and replace each of them by the switch of lamp $n+\ell$. This can be done in $2^{k_{\ell}-1}$ ways (because a $k_{\ell}$-element set has $2^{k_{\ell}-1}$ subsets of even cardinality). Notice that $k_{1}+\cdots+k_{n}=k$. These actions are independent, in the sense that the action involving lamp $\ell$ does not affect the action involving any other lamp. So there are $2^{k_{1}-1} \cdot 2^{k_{2}-1} \cdots 2^{k_{n}-1}=2^{k-n}$ ways of combining these actions. In any of these combinations, each one of the lamps $n+1, \ldots, 2 n$ gets switched an even number of times and each one of the lamps $1, \ldots, n$ remains switched an odd number of times, so the final state is the same as that resulting from the original process $\mathbf{p}$. This shows that every restricted admissible process $\mathbf{p}$ can be modified in $2^{k-n}$ ways, giving rise to $2^{k-n}$ distinct admissible processes (with all lamps allowed). Now we show that every admissible process $\mathbf{q}$ can be achieved in that way. Indeed, it is enough to replace every switch of a lamp with a label $\ell>n$ that occurs in $\mathbf{q}$ by the switch of the corresponding lamp $\ell-n$; in the resulting process $\mathbf{p}$ the lamps $n+1, \ldots, 2 n$ are not involved. Switches of each lamp with a label $\ell>n$ had occurred in $\mathbf{q}$ an even number of times. So the performed replacements have affected each lamp with a label $\ell \leq n$ also an even number of times; hence in the overall effect the final state of each lamp has remained the same. This means that the resulting process $\mathbf{p}$ is admissible - and clearly restricted, as the lamps $n+1, \ldots, 2 n$ are not involved in it any more. If we now take process $\mathbf{p}$ and reverse all these replacements, then we obtain process $\mathbf{q}$. These reversed replacements are nothing else than the modifications described in the foregoing paragraphs. Thus there is a one-to $-\left(2^{k-n}\right)$ correspondence between the $M$ restricted admissible processes and the total of $N$ admissible processes. Therefore $N / M=2^{k-n}$. C5. Let $S=\left\{x_{1}, x_{2}, \ldots, x_{k+\ell}\right\}$ be a $(k+\ell)$-element set of real numbers contained in the interval $[0,1] ; k$ and $\ell$ are positive integers. A $k$-element subset $A \subset S$ is called nice if $$ \left|\frac{1}{k} \sum_{x_{i} \in A} x_{i}-\frac{1}{\ell} \sum_{x_{j} \in S \backslash A} x_{j}\right| \leq \frac{k+\ell}{2 k \ell} . $$ Prove that the number of nice subsets is at least $\frac{2}{k+\ell}\left(\begin{array}{c}k+\ell \\ k\end{array}\right)$. Solution. For a $k$-element subset $A \subset S$, let $f(A)=\frac{1}{k} \sum_{x_{i} \in A} x_{i}-\frac{1}{\ell} \sum_{x_{j} \in S \backslash A} x_{j}$. Denote $\frac{k+\ell}{2 k \ell}=d$. By definition a subset $A$ is nice if $|f(A)| \leq d$. To each permutation $\left(y_{1}, y_{2}, \ldots, y_{k+\ell}\right)$ of the set $S=\left\{x_{1}, x_{2}, \ldots, x_{k+\ell}\right\}$ we assign $k+\ell$ subsets of $S$ with $k$ elements each, namely $A_{i}=\left\{y_{i}, y_{i+1}, \ldots, y_{i+k-1}\right\}, i=1,2, \ldots, k+\ell$. Indices are taken modulo $k+\ell$ here and henceforth. In other words, if $y_{1}, y_{2}, \ldots, y_{k+\ell}$ are arranged around a circle in this order, the sets in question are all possible blocks of $k$ consecutive elements. Claim. At least two nice sets are assigned to every permutation of $S$. Proof. Adjacent sets $A_{i}$ and $A_{i+1}$ differ only by the elements $y_{i}$ and $y_{i+k}, i=1, \ldots, k+\ell$. By the definition of $f$, and because $y_{i}, y_{i+k} \in[0,1]$, $$ \left|f\left(A_{i+1}\right)-f\left(A_{i}\right)\right|=\left|\left(\frac{1}{k}+\frac{1}{\ell}\right)\left(y_{i+k}-y_{i}\right)\right| \leq \frac{1}{k}+\frac{1}{\ell}=2 d \text {. } $$ Each element $y_{i} \in S$ belongs to exactly $k$ of the sets $A_{1}, \ldots, A_{k+\ell}$. Hence in $k$ of the expressions $f\left(A_{1}\right), \ldots, f\left(A_{k+\ell}\right)$ the coefficient of $y_{i}$ is $1 / k$; in the remaining $\ell$ expressions, its coefficient is $-1 / \ell$. So the contribution of $y_{i}$ to the sum of all $f\left(A_{i}\right)$ equals $k \cdot 1 / k-\ell \cdot 1 / \ell=0$. Since this holds for all $i$, it follows that $f\left(A_{1}\right)+\cdots+f\left(A_{k+\ell}\right)=0$. If $f\left(A_{p}\right)=\min f\left(A_{i}\right), f\left(A_{q}\right)=\max f\left(A_{i}\right)$, we obtain in particular $f\left(A_{p}\right) \leq 0, f\left(A_{q}\right) \geq 0$. Let $pq$ 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 $y180^{\circ}, \end{gathered} $$ point $P$ lies in triangle $C D Q$, and hence in $A B C D$. The proof is complete. ![](https://cdn.mathpix.com/cropped/2024_04_17_e32cef0f3c5b05a0a6b1g-40.jpg?height=757&width=1008&top_left_y=1489&top_left_x=501) 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$. ![](https://cdn.mathpix.com/cropped/2024_04_17_e32cef0f3c5b05a0a6b1g-41.jpg?height=1068&width=1079&top_left_y=1156&top_left_x=523) 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 $0a_{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+21$. 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 \ell1$ ). 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.