exam: BalticWay

problem:
The numbers from 1 to 360 are partitioned into 9 subsets of consecutive integers and the sums of the numbers in each subset are arranged in the cells of a $3 \times 3$ square. Is it possible that the square turns out to be a magic square?

Remark: A magic square is a square in which the sums of the numbers in each row, in each column and in both diagonals are all equal.

Answer: Yes.

solution: . If the numbers $a_{1}, a_{2}, \ldots, a_{9}$ form a $3 \times 3$ magic square, then the numbers $a_{1}+d, a_{2}+d, \ldots, a_{9}+d$ form a $3 \times 3$ magic square, too. Hence it is sufficient to divide all the numbers into parts with equal numbers of elements: i.e. from $40 k+1$ to $40(k+1), k=0,1, \ldots, 8$. Then we need to arrange the least numbers of these parts (i.e. the numbers $1,41,81, \ldots, 321$ ) in the form of a magic square (we omit here an example, it is similar to the magic square with numbers 1 , $2, \ldots, 9)$. After that all other numbers $1+s, 41+s, \ldots, 321+s$ will also form a magic square $(s=1, \ldots, 39)$, and so do the whole sums.

problem_match: # Problem 1

solution_match: Solution 1


solution: . Distribute the numbers into nine parts $40 k+1,40 k+2, \ldots, 40 k+40$, $k=0,2, \ldots, 8$. Note that the sums of these parts form an arithmetic progression: the sums are $(40 k+1+40 k+40) \cdot 20=1600 k+820, k=0,1, \ldots, 8$. It remains to construct a magic square of the numbers of the progression $820,2420, \ldots, 13620$ as follows. Start from an initial magic square with $0,1, \ldots, 8$ (or similar), multiply all members by 1600 (this is again a magic square) and add 820 to every member (again a magic square).

solution_match: Solution 2


problem:
Let $a, b, c$ be real numbers. Prove that

$$
a b+b c+c a+\max \{|a-b|,|b-c|,|c-a|\} \leq 1+\frac{1}{3}(a+b+c)^{2} .
$$

solution:
. We may assume $a \leq b \leq c$, whence $\max \{|a-b|,|b-c|,|c-a|\}=c-a$. The initial inequality is equivalent to

$$
c-a \leq 1+\frac{1}{3}\left(a^{2}+b^{2}+c^{2}-a b-b c-a c\right)
$$

which in turn is equivalent to

$$
c-a \leq 1+\frac{1}{6}\left((a-c)^{2}+(b-c)^{2}+(a-b)^{2}\right) .
$$

Since $\sqrt{\frac{(c-b)^{2}+(b-a)^{2}}{2}} \geq \frac{c-a}{2}$, we have

$$
(a-c)^{2}+(b-c)^{2}+(a-b)^{2} \geq \frac{3}{2}(c-a)^{2}
$$

and hence

$$
1+\frac{1}{6}\left((a-c)^{2}+(b-c)^{2}+(a-b)^{2}\right) \geq 1+\frac{1}{4}(c-a)^{2} \geq c-a
$$

as desired.

problem_match: # Problem 2


solution:
. Assume $a \leq b \leq c$. By the well-known inequality $x y+y z+z x \leq$ $x^{2}+y^{2}+z^{2}$ (it can be shown by $2 x y \leq x^{2}+y^{2}$, etc., and adding all three such inequalities) we have

$$
\begin{gathered}
a b+b c+c a-a+c-1=(a+1) b+b(c-1)+(a+1)(c-1) \leq(a+1)^{2}+b^{2}+(c-1)^{2} \\
\quad=a^{2}+b^{2}+c^{2}+2(a-c+1)=(a+b+c)^{2}-2(a b+b c+c a+c-a-1)
\end{gathered}
$$

or

$$
a b+b c+c a+c-a \leq 1+\frac{1}{3}(a+b+c)^{2} .
$$


solution:
. Assume $a \leq b \leq c$ and take $c=a+x, b=a+y$, where $x \geq y \geq 0$. The inequality $3(a b+b c+c a+c-a-1) \leq(a+b+c)^{2}$ then reduces to

$$
x^{2}-x y+y^{2}+3 \geq 3 x \text {. }
$$

The latter inequality is equivalent to the inequality

$$
\left(\frac{x}{2}-y\right)^{2}+\frac{3}{4} x^{2}-3 x+3 \geq 0
$$

which in turn is equivalent to the inequality

$$
\frac{4}{3}\left(\frac{x}{2}-y\right)^{2}+(x-2)^{2} \geq 0
$$

Remark 1. The inequality $x^{2}-3 x-x y+y^{2}+3 \geq 0$ can also be proven by noticing that the discriminant of the LHS, $(y+3)^{2}-4\left(y^{2}+3\right)=-3(y-1)^{2}$, is non-positive. Since the quadratic polynomial in $x$ has positive leading coefficient, its all values are non-negative.

Remark 2. Another way to prove the inequality $x^{2}-3 x-x y+y^{2}+3 \geq 0$ is, by AM-GM, the following:

$$
\begin{aligned}
& 3 x+x y=\sqrt{(\sqrt{2} x)^{2}\left(\frac{3}{\sqrt{2}}+\frac{y}{\sqrt{2}}\right)^{2}} \leq \frac{(\sqrt{2} x)^{2}+\left(\frac{3}{\sqrt{2}}+\frac{y}{\sqrt{2}}\right)^{2}}{2} \\
&= x^{2}+\frac{9}{4}+\frac{3}{2} y+\frac{y^{2}}{4}=3+x^{2}+y^{2}-\frac{3}{4}(y-1)^{2} \leq 3+x^{2}+y^{2} .
\end{aligned}
$$

solution_match: Solution 3


solution:
. Assume $a \leq b \leq c$ and take $a=b-k, c=b+l$, where $k, l \geq 0$. The inequality $3(a b+b c+c a+c-a-1) \leq(a+b+c)^{2}$ then reduces to

$$
k^{2}+l^{2}+k l-3 l-3 k+3 \geq 0 .
$$

This is equivalent to

$$
(k-1)^{2}+(l-1)^{2}+(k-1)(l-1) \geq 0,
$$

which holds, since $x^{2}+y^{2}+x y \geq 0$ for all real numbers $x, y$.

Remark. The inequality $k^{2}+l^{2}+k l-3 l-3 k+3 \geq 0$ can also be proven by separating perfect squares as

$$
\frac{1}{4}(k-l)^{2}+\frac{3}{4}(k+l)^{2}-3 \cdot(k+l)+3 \geq 0
$$

which is in turn similar to

$$
(k-l)^{2}+3(k+l-2)^{2} \geq 0 .
$$

solution_match: Solution 4


solution:
. Assume $a \leq b \leq c$. Expand the inequality $3(a b+b c+c a+c-a-1) \leq$ $(a+b+c)^{2}$ fully to obtain $a^{2}+b^{2}+c^{2}-a b-a c-b c+3 a-3 c+3 \geq 0$. Now fix $\alpha \in \mathbb{R}$ and consider the set

$$
\gamma=\left\{(a, b, c): a^{2}+b^{2}+c^{2}-a b-a c-b c+3 a-3 c+3+\alpha=0\right\} .
$$

Note that $\gamma$ is a quadric. Its invariants are

$\delta=\left|\begin{array}{ccc}1 & -\frac{1}{2} & -\frac{1}{2} \\ -\frac{1}{2} & 1 & -\frac{1}{2} \\ -\frac{1}{2} & -\frac{1}{2} & 1\end{array}\right|=0, \quad \Delta=\left|\begin{array}{cccc}1 & -\frac{1}{2} & -\frac{1}{2} & \frac{3}{2} \\ -\frac{1}{2} & 1 & -\frac{1}{2} & 0 \\ -\frac{1}{2} & -\frac{1}{2} & 1 & -\frac{3}{2} \\ \frac{3}{2} & 0 & -\frac{3}{2} & 3+\alpha\end{array}\right|=0, \quad S=3 \cdot\left|\begin{array}{cc}1 & -\frac{1}{2} \\ -\frac{1}{2} & 1\end{array}\right|=\frac{9}{4}$,

and

$$
K=\left|\begin{array}{ccc}
1 & -\frac{1}{2} & \frac{3}{2} \\
-\frac{1}{2} & 1 & 0 \\
\frac{3}{2} & 0 & 3+\alpha
\end{array}\right|+\left|\begin{array}{ccc}
1 & -\frac{1}{2} & \frac{3}{2} \\
-\frac{1}{2} & 1 & -\frac{3}{2} \\
\frac{3}{2} & -\frac{3}{2} & 3+\alpha
\end{array}\right|+\left|\begin{array}{ccc}
1 & -\frac{1}{2} & 0 \\
-\frac{1}{2} & 1 & -\frac{3}{2} \\
0 & -\frac{3}{2} & 3+\alpha
\end{array}\right|=\frac{9 \alpha}{4} .
$$

In the case $\alpha>0$, it is known from the theory of quadrics that the surface $\gamma$ is an imaginary elliptic cylinder $(\delta=\Delta=0, S>0$, and $K>0)$ and therefore contains no real points. Hence the condition $a^{2}+b^{2}+c^{2}-a b-a c-b c+3 a-3 c+3+\alpha=0$ implies that $\alpha \leq 0$, therefore

$$
a^{2}+b^{2}+c^{2}-a b-a c-b c+3 a-3 c+3=-\alpha \geq 0
$$

as desired.

solution_match: Solution 5


solution:
. We start as in Solution 5: construct the quadric

$$
\gamma=\left\{(a, b, c): a^{2}+b^{2}+c^{2}-a b-a c-b c+3 a-3 c+3+\alpha=0\right\} .
$$

Now note that the substitution

$$
\left\{\begin{array}{l}
a=2 x-y+2 z \\
b=2 y+2 z \\
c=-2 x-y+2 z
\end{array}\right.
$$

gives (in the new coordinate system)

$$
\gamma=\left\{(x, y, z): 12 x^{2}+9 y^{2}+12 x+3+\alpha=0\right\} .
$$

(The columns of the coefficient matrix $C=\left(\begin{array}{ccc}2 & -1 & 2 \\ 0 & 2 & 2 \\ -2 & -1 & 2\end{array}\right)$ of the substitution are in fact the orthogonalized eigenvectors of $\left(\begin{array}{ccc}1 & -\frac{1}{2} & -\frac{1}{2} \\ -\frac{1}{2} & 1 & -\frac{1}{2} \\ -\frac{1}{2} & -\frac{1}{2} & 1\end{array}\right)$.) Since

$$
12 x^{2}+9 y^{2}+12 x+3+\alpha=3(2 x+1)^{2}+9 y^{2}+\alpha
$$

it is clear that in the case $\alpha>0$, the set $\gamma$ is void.

Remark 1. Solutions 5 and 6 are presented here for instructive purposes only.

Remark 2. Solutions 3, 4, and 6 suggest also general substitutions in the initial equation that directly leave the inequality in the form of sum of squares. Let these substitutions be mentioned here.

- Solution 3 suggests $T=\frac{a-2 b+c}{2}, U=c-a-2$, and reduces the original inequality to $\frac{4}{3} T^{2}+U^{2} \geq 0$;
- solution 4 together with its remark suggests $T=2 b-a-c, U=c-a-2$, and reduces the original inequality to $T^{2}+3 U^{2} \geq 0$;
- solution 6 suggests $U=\frac{a-c}{2}+1, T=\frac{-a+2 b-c}{6}$, and reduces the original inequality to $3 U^{2}+9 T^{2} \geq 0$.

Hence, up to scaling, all these three solutions are essentially the same.

solution_match: Solution 6


problem:
a) Show that the equation

$$
\lfloor x\rfloor\left(x^{2}+1\right)=x^{3},
$$

where $\lfloor x\rfloor$ denotes the largest integer not larger than $x$, has exactly one real solution in each interval between consecutive positive integers.

b) Show that none of the positive real solutions of this equation is rational.

solution:
a) Let $k=\lfloor x\rfloor$ and $y=x-k$. Then the equation becomes

$$
k\left((k+y)^{2}+1\right)=(k+y)^{3},
$$

which reduces to

$$
y(k+y)^{2}=k \text {. }
$$

The function $f(y)=y(k+y)^{2}$ is strictly increasing in $[0,1]$ and continuous in the same interval. As $f(0)=0<k$ and $f(1)=(k+1)^{2}>k$, there exists exactly one $y_{0} \in(0,1)$ such that $f\left(y_{0}\right)=k$.

b) The equation (1) has no positive integral solutions. Assume that $x=k+y$ is rational and let $x=n / d$, where $n$ and $d$ are relatively prime positive integers. The given equation then becomes

$$
\frac{k\left(n^{2}+d^{2}\right)}{d^{2}}=\frac{n^{3}}{d^{3}}
$$

or

$$
d k\left(n^{2}+d^{2}\right)=n^{3} .
$$

Since $x$ is not an integer, $d$ has at least one prime divisor. It follows from the last equation that this prime divisor also divides $n$, a contradiction.

Remark. In a), one can also consider the function $g(y)=y(k+y)^{2}-k$, perhaps expand it, and, using its derivative in $(0,1)$, prove that $g$ is strictly increasing in $[0,1]$.

problem_match: # Problem 3

solution_match: Solution.


problem:
Prove that for infinitely many pairs $(a, b)$ of integers the equation

$$
x^{2012}=a x+b
$$

has among its solutions two distinct real numbers whose product is 1 .

solution:
. Observe first that for any integer $m>2$ the quadratic polynomial $x^{2}-m x+1$ has two distinct positive roots whose product equals 1 .

Moreover, for any integer $m>2$ there exists a pair of integers $\left(a_{m}, b_{m}\right)$ such that the polynomial $x^{2012}-a_{m} x-b_{m}$ is divisible by the polynomial $x^{2}-m x+1$. Indeed, dividing the monomial $x^{2012}$ by the monic polynomial $x^{2}-m x+1$ we get a remainder $R_{m}(x)$ which is a polynomial with integer coefficients and degree at most 1. Thus $R_{m}(x)=a_{m} x+b_{m}$ for some integers $a_{m}$ and $b_{m}$, which clearly meet our demand.

Now, for a fixed $m>2$, any root of the polynomial $x^{2}-m x+1$ is also a root of the polynomial $x^{2012}-a_{m} x-b_{m}$. Therefore the set of solutions of the equation $x^{2012}=a_{m} x+b_{m}$ contains the two distinct roots of the polynomial $x^{2}-m x+1$, whose product is equal to 1 . This means that the pair $(a, b)=\left(a_{m}, b_{m}\right)$ has the required property.

It remains to show that when $m$ ranges over all integers greater than 2 , we get infinitely many distinct pairs $\left(a_{m}, b_{m}\right)$. To this end, note that for $m_{1} \neq m_{2}$ the roots of the polynomial $x^{2}-m_{1} x+1$ are distinct from the roots of the polynomial $x^{2}-m_{2} x+1$, since a common root of them would be a root of their difference $\left(m_{2}-m_{1}\right) x$, and so it would be equal to zero, which is not a root of any $x^{2}-m x+1$. As the polynomial $x^{2012}-a x-b$ has at most 2012 distinct roots, it is divisible by $x^{2}-m x+1$ for at most 1006 values of $m$. Hence the same pair $\left(a_{m}, b_{m}\right)$ can be obtained for at most 1006 values of $m$, which concludes the proof.

problem_match: # Problem 4


solution:
. Observe first that for any integer $c>2$ the equations $x=x-0$ and $x^{2}=c x-1$ have two common distinct positive solutions whose product equals 1 . Let those solutions be $x_{1}$ and $x_{2}$.

Define a sequence $\left(f_{n}\right)$ by $f_{0}=0, f_{1}=1$, and $f_{n+2}=c f_{n+1}-f_{n}, n \geq 0$. Suppose that $x_{1}$ and $x_{2}$ are also common solutions of the equations $x^{n}=f_{n} x-f_{n-1}$ and $x^{n+1}=f_{n+1} x-f_{n}$, then the following equalities hold for $x=x_{1}$ and $x=x_{2}$ :

$$
\begin{aligned}
& x^{n+2}-f_{n+2} x+f_{n+1}=x^{n+2}-\left(c f_{n+1}-f_{n}\right) x+\left(c f_{n}-f_{n-1}\right) \\
= & x^{n+2}-c\left(f_{n+1} x-f_{n}\right)+\left(f_{n} x-f_{n-1}\right)=x^{n+2}-c x^{n+1}+x^{n}=x^{n}\left(x^{2}-c x+1\right)=0,
\end{aligned}
$$

which shows that $x_{1}$ and $x_{2}$ are solutions of $x^{n+2}=f_{n+2} x-f_{n+1}$ as well.

Now note that for different integers $c$, all corresponding members of the sequences $\left(f_{n}\right)$ are different. At first note that these sequences $\left(f_{n}\right)$ are strictly increasing: by inductive argument we have

$$
f_{n+2}-f_{n+1}=(c-1) f_{n+1}-f_{n}>f_{n+1}-f_{n}>0 .
$$

This also shows that all members are positive.

Now, let us have integers $c$ and $c^{\prime}$ with $c^{\prime} \geq c+1>3$ and let the corresponding sequences be $\left(f_{n}\right)$ and $\left(f_{n}^{\prime}\right)$. Then again by induction

$f_{n+2}^{\prime} \geq(c+1) f_{n+1}^{\prime}-f_{n}^{\prime}=c f_{n+1}^{\prime}+\left(f_{n+1}^{\prime}-f_{n}^{\prime}\right)>c f_{n+1}^{\prime}>c f_{n+1}>c f_{n+1}-f_{n}=f_{n+2}$.

We have shown that for all integers $c>2$, the respective pairs $\left(f_{2012},-f_{2011}\right)$ are different, as desired.


solution:
. Consider any even integer $2 c>2$. The roots of $x^{2}-2 c x+1$ are $c \pm \sqrt{c^{2}-1}$ and their product is 1 . Now consider the expansion

$$
\left(c+\sqrt{c^{2}-1}\right)^{2012}=\alpha+\beta \sqrt{c^{2}-1}=\beta\left(c+\sqrt{c^{2}-1}\right)+(\alpha-\beta c)
$$

where $\alpha$ and $\beta$ are some integers. Denote $a=\beta$ and $b=\alpha-\beta c$, then $c+\sqrt{c^{2}-1}$ is a solution of $x^{2012}=a x+b$.

Simple calculation shows that

$$
\left(c-\sqrt{c^{2}-1}\right)^{2012}=\alpha-\beta \sqrt{c^{2}-1}=\beta\left(c-\sqrt{c^{2}-1}\right)+(\alpha-\beta c),
$$

yielding that also $c-\sqrt{c^{2}-1}$ is a solution of $x^{2012}=a x+b$.

To complete the proof, it remains to point out that $a=\beta \geq 2012 \cdot c^{2011}$ which means that the number $a$ can be chosen arbitrarily large.


solution:
. Note that the function $f:(1, \infty) \rightarrow \mathbb{R}, f(x)=x+x^{-1}$, is strictly increasing (it can be easily shown by derivative) and achieves all values of $(2, \infty)$. Hence let us have an arbitrary integer $c>2$ where $c=\lambda+\lambda^{-1}$ for some real $\lambda>1$.

Define

$$
a=\frac{\lambda^{2012}-\lambda^{-2012}}{\lambda-\lambda^{-1}}, \quad b=\frac{-\lambda^{2011}+\lambda^{-2011}}{\lambda-\lambda^{-1}} .
$$

Then it is easy to verify that $\lambda$ and $\lambda^{-1}$ are solutions of $x^{2012}=a x+b$.

Note that $a$ and $b$ are integers. Indeed: for any positive integer $k$, we have

$$
\lambda^{k}-\left(\lambda^{-1}\right)^{k}=\left(\lambda-\lambda^{-1}\right) \cdot\left(\lambda^{k-1}+\lambda^{k-2} \cdot \lambda^{-1}+\ldots+\lambda \cdot\left(\lambda^{-1}\right)^{k-2}+\left(\lambda^{-1}\right)^{k-1}\right),
$$

where the rightmost factor is a symmetric polynomial with integral coefficients in two variables and therefore can be expressed as a polynomial with integral coefficients in symmetric fundamental polynomials $\lambda+\lambda^{-1}$ and $\lambda \cdot \lambda^{-1}=1$, hence is an integer.

If there were only a finite number of integer pairs $(a, b)$ for which $x^{2012}-a x-b$ has two distinct roots whose product is 1 , the number of all such roots would also be finite. This would be a contradiction since by the construction above, there are infinitely many such numbers $\lambda$ for which $\lambda+\lambda^{-1} \in\{3,4, \ldots\}$ and that $\lambda, \lambda^{-1}$ are roots of some $x^{2012}-a x-b$ where $a, b$ are integers.


problem:
Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ for which

$$
f(x+y)=f(x-y)+f(f(1-x y))
$$

holds for all real numbers $x$ and $y$.

Answer: $f(x) \equiv 0$.

solution:
Substituting $y=0$ gives $f(x)=f(x)+f(f(1))$, hence $f(f(1))=0$. Using this after substituting $x=0$ into the original equation gives $f(y)=f(-y)$ for all $y$, i.e., $f$ is even.

Substituting $x=1$ into the original equation gives $f(1+y)=f(1-y)+$ $f(f(1-y))$. By $f$ being even, also $f(-1-y)=f(1-y)+f(f(1-y))$. Hence $f(f(1-y))=f(1-y-2)-f(1-y)$. As $1-y$ covers all real values, one can conclude that

$$
f(f(z))=f(z-2)-f(z)
$$

for all real numbers $z$.

Substituting $-z$ for $z$ into (4) and simplifying the terms by using that $f$ is even, one obtains $f(f(z))=f(z+2)-f(z)$. Together with (4), this implies

$$
f(z+2)=f(z-2)
$$

for all real numbers $z$.

Now taking $y=2$ in the original equation followed by applying (5) leads to $f(f(1-2 x))=0$ for all real $x$. As $1-2 x$ covers all real values, one can conclude that

$$
f(f(z))=0
$$

for all real numbers $z$. Thus the original equation reduces to

$$
f(x+y)=f(x-y) .
$$

Taking $x=y$ here gives $f(2 x)=f(0)$, i.e., $f$ is constant, as $2 x$ covers all real numbers. As 0 must be among the values of $f$ by (6), $f(x) \equiv 0$ is the only possibility.

problem_match: # Problem 5


problem:
There are 2012 lamps arranged on a table. Two persons play the following game. In each move the player flips the switch of one lamp, but he must never get back an arrangement of the lit lamps that has already been on the table. A player who cannot move loses. Which player has a winning strategy?

Answer: the first player has a winning strategy.

solution: . The first player can pick one lamp and keep switching it on and off during the whole game. The second player cannot switch this particular lamp, he always has to switch some other lamp so that the arrangement of the other lamps becomes different from any that has already been on the table. So the first player always has a move, and the second player eventually runs out of the possible moves.

problem_match: # Problem 6


solution:
. Note that the parity of the lit lamps changes with each move. So all the possible states can be divided into two disjoint sets, one with odd number of of the lamps lit and the other with even number of the lamps lit. We get a bipartite graph where the vertices are the states and two states are connected with an edge if it is possible to get from one state to another by switching one lamp off or on.

We want to use Hall's marriage theorem to get a perfect matching of the states. The assumption of the theorem is the following: for every subset A of the states in one set there is at least as many neighboring states in the second set. Let the number of states in $A$ be $n$, and let $B$ be the set of neighboring states of $A$, containing $m$ states. Since each state in $A$ has exactly 2012 neighbors and all these neighbors belong to the set $B$, there are exactly $2012 n$ edges between $A$ and $B$. Since each state in $B$ has exactly 2012 neighbors (some of them may not belong to $A$ ), there is at most $2012 m$ edges between $A$ and $B$. Hence $2012 n \leq 2012 m$, or $n \leq m$, i.e. the assumption of the theorem is satisfied.

Now the Hall's theorem states that there is a perfect matching. On every move the first player has to switch the lamp which changes the state into it's partner in the perfect matching. Any lamp the second player can switch results in a state whose partner has not been used yet, so the first player always has a move, and the secod player eventually loses.


problem: On a $2012 \times 2012$ board, some cells on the top-right to bottom-left diagonal are marked. None of the marked cells is in a corner. Integers are written in each cell of this board in the following way. All the numbers in the cells along the upper and the left sides of the board are 1's. All the numbers in the marked cells are 0's. Each of the other cells contains a number that is equal to the sum of its upper neighbour and its left neighbour. Prove that the number in the bottom right corner is not divisible by 2011 .

solution:
. Let a peg go on the board, stepping from a cell to the neighbor cell right or below. Then the number in the bottom right corner of the board is equal to the number of paths of the peg from the top left corner to the bottom right corner, which do not visit the marked cells.

The total number of paths (including those that pass through the marked cells) equals $\left(\begin{array}{l}4022 \\ 2011\end{array}\right)$; this number is not divisible by 2011, because 2011 is a prime number. The number of paths that pass through the $k$-th cell of the diagonal equals $\left(\begin{array}{c}2011 \\ k\end{array}\right)^{2}$, because in order to visit this cell starting from the corner the peg should make 2011 steps, $k$ of which are horizontal, and others are vertical; and after the visit it also should make 2011 steps, $k$ of which is vertical. Since $k \neq 0,2011$ (because the marked cells are not in the corner) this number is divisible by 2011.

So the number in the low right corner equals the difference of the number that is not divisible by 2011 and several numbers that are divisible by 2011 .

problem_match: # Problem 7


solution:
. Turning the board $45^{\circ}$ so that the upper left corner is on the top we notice that the numbers written on the board constitute the Pascal's triangle. If there were no marked cells on the board, then the number on the bottom cell
would be $\left(\begin{array}{l}4022 \\ 2011\end{array}\right)$, which is not divisible by 2011. All the cells on the diagonal that is

now horizontal, would be of the form $\left(\begin{array}{c}2011 \\ k\end{array}\right)$; all of them, except the numbers in the corners, would be divisible by 2011. If we substitute the numbers on the diagonal with their remainders modulo 2011, then all the numbers on the diagonal are 0's, independent of whether they were marked or not, except in the corners there are 1 's. After this change all numbers below the diagonal get substituted with their remainders modulo 2011. All the numbers below the diagonal are now 0's, except along the sides are 1's and in the bottom corner there is 2 . Hence the remainder of the number written in the bottom corner modulo 2012 is 2 .


problem: A directed graph does not contain directed cycles. The number of edges in any directed path does not exceed 99. Prove that it is possible to colour the edges of the graph in 2 colours so that the number of edges in any single-coloured directed path in the graph will not exceed 9 .

solution: Label each vertex by the number from 0 to 99 , that is equal to the length of the longest directed path that ends in this vertex. Then every edge goes from a vertex with a smaller label to a vertex with a larger label. Now colour this edge in red if the digit of tens in the larger label is greater than the digit of tens in the smaller label. Otherwise colour this edge in blue. Since the number of tens is the same in all vertices on a blue path, the length of the path cannot exceed 9 . Since the number of tens is different in all vertices on a red path, the length of the path also cannot exceed 9 .

problem_match: # Problem 8


problem:
Zeroes are written in all cells of a $5 \times 5$ board. We can take an arbitrary cell and increase by 1 the number in this cell and all cells having a common side with it. Is it possible to obtain the number 2012 in all cells simultaneously?

Answer: No.

solution:
. Let $a_{(i, j)}$ be the number written in the cell in the row $i$ and column $j$. To prove that it is not possible to get 2012 written in each cell, we choose a factor $c_{(i, j)}$ for each cell, such that

$$
S=\sum_{1 \leq i, j \leq 5} c_{(i, j)} \cdot a_{(i, j)}
$$

increases by the same number each time a cell is chosen. If we choose the factors $c_{(i, j)}$ as shown in Figure 1, then $S$ increases by 22 each time a cell is chosen. Hence $S$ is divisible by 22 at all times. The sum of all the $c_{(i, j)}$ is 138 , hence if 2012 is written in each cell, then

$$
S=138 \cdot 2012=2^{3} \cdot 3 \cdot 23 \cdot 503
$$

which cannot be reached, since it is not divisible by 22 .

problem_match: # Problem 9


solution:
. Divide all cells into six disjoint sets as follows: the set $A$ consists of all corner cells, the set $B$ consists of all cells, having a common side with the corner cells, the set $C$ consists of all diagonal neighbors of the corner cells, the set $D$ consists of all middle cells of the sides of the board, the set $E$ consists of all cells having a common side with the center cell, and the set $F$ has only the center cell in it. Suppose we choose $a$ times a cell from the set $A, b$ times from the set $B$ etc. Suppose that after a number of steps we get the number $s$ written in each cell. Since only the cells from the sets $A$ and $B$ contribute to the numbers written in the cells of the set $A$ and each choice from these sets contributes exactly 1 to the sum of the numbers written in the cells of the set $A$, we have $a+b=4 s$. Similarly, considering the sum of the numbers written in the cells of the set $B$, we see that choosing a cell from the set $A$ contributes 2 to the sum, choosing a cell from the set $B$ contributes 1, a cell from $C$ contributes 2 and a cell from $D$ contributes 2, hence $2 a+b+2 c+2 d=8 s$. Continuing, we get $b+c+2 e=4 s, b+d+e=4 s$, $2 c+d+e+4 f=4 s$, and $e+f=s$. Eliminating $a, b, d, e$, and $f$ from these equations we get $11 c=4 s$. This is only possible if $s$ is divisible by 11 . Since 2012 is not divisible by 11, it is not possible to get 2012 written in each cell.

Remark. For every positive $s$ divisible by 11 it is possible to get $s$ written in each cell. For $s=11$ Figure 2 shows how many times one has to choose each cell. If $s$ is larger than 11 , we can simply repeat these steps as many times as needed. The same figure can also be used for choosing factors as in Solution 1.


problem:
Two players $A$ and $B$ play the following game. Before the game starts, $A$ chooses 1000 not necessarily different odd primes, and then $B$ chooses half of them and writes them on a blackboard. In each turn a player chooses a positive integer $n$, erases some primes $p_{1}, p_{2}, \ldots, p_{n}$ from the blackboard and writes all the prime factors of $p_{1} p_{2} \ldots p_{n}-2$ instead (if a prime occurs several times in the prime factorization of $p_{1} p_{2} \ldots p_{n}-2$, it is written as many times as it occurs). Player $A$ starts, and the player whose move leaves the blackboard empty loses the game. Prove that one of the two players has a winning strategy and determine who.

Remark: Since 1 has no prime factors, erasing a single 3 is a legal move.

solution:
Player $A$ has a winning strategy.

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-10.jpg?height=454&width=459&top_left_y=2103&top_left_x=570)

Figure 1

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-10.jpg?height=451&width=457&top_left_y=2102&top_left_x=1208)

Figure 2

Let player $A$ choose 1000 primes all congruent to 1 modulo 4 . Then there are 500 primes congruent to 1 modulo 4 when the game begins. Let $P$ denote the parity of the number of primes congruent to 3 modulo 4 on the blackboard. When the game starts, $P$ is even. Remember that the number of primes congruent to 3 modulo 4 in the prime factorization of a number is even if the number is congruent to 1 modulo 4, and odd if the number is congruent to 3 modulo 4 . In each turn the parity of $P$ changes, because the number of primes congruent to 3 modulo 4 among $p_{1}, p_{2}, \ldots$, $p_{n}$ and in the prime factorization of $p_{1} p_{2} \ldots p_{n}-2$ is of different parity. Hence $P$ is odd after each of $A$ 's turns and even after each of $B$ 's turns, so $A$ cannot lose. Since the product of all the primes on the blackboard decreases with each turn, the game eventually ends, hence $A$ wins.

problem_match: # Problem 10


problem: Let $A B C$ be a triangle with $\angle A=60^{\circ}$. The point $T$ lies inside the triangle in such a way that $\angle A T B=\angle B T C=\angle C T A=120^{\circ}$. Let $M$ be the midpoint of $B C$. Prove that $T A+T B+T C=2 A M$.

solution:
. Rotate the triangle $A B C$ by $60^{\circ}$ around the point $A$ (Figure 3). Let $T^{\prime}$ and $C^{\prime}$ be the images of $T$ and $C$, respectively. Then the triangle $A T T^{\prime}$ is equilateral and $\angle A T^{\prime} C^{\prime}=120^{\circ}$, meaning that $B, T, T^{\prime}, C^{\prime}$ are collinear and $T A+T B+T C=B C^{\prime}$. Let $A^{\prime}$ be a point such that $A B A^{\prime} C$ is a parallelogram. Then $2 A M=A A^{\prime}$. It remains to observe that the triangles $B A C^{\prime}$ and $A B A^{\prime}$ are equal, since $B A$ is common, $\angle B A C^{\prime}=120^{\circ}=\angle A^{\prime} B A$, and $A C^{\prime}=B A^{\prime}$.

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-11.jpg?height=531&width=1304&top_left_y=1528&top_left_x=296)

Figure 3

Remark. The rotation used here is the same as that used in finding a point $P$ in the triangle such that the total distance from the three vertices of the triangle to $P$ is the minimum possible (Fermat point); this is exactly the point $T$ in the problem.

problem_match: # Problem 11


solution:
. Let $A^{\prime}$ be a point such that $A B A^{\prime} C$ is a parallelogram. Since $\angle B A^{\prime} C=60^{\circ}$ and $\angle B T C=120^{\circ}$, the point $T$ lies on the circumcircle of $A^{\prime} B C$. Let $X$ be the second intersection point of $A T$ with this circumcircle and let $Y$ be the midpoint of $A^{\prime} X$. The triangle $B C X$ is equilateral, since $\angle B X C=\angle B A^{\prime} C=60^{\circ}$ and $\angle B C X=\angle B T X=180^{\circ}-\angle B T A=60^{\circ}$. Therefore $T B+T C=T X$. So it is sufficient to show that $A X=A A^{\prime}$.

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-12.jpg?height=751&width=1042&top_left_y=293&top_left_x=587)

Figure 4

Let $K$ be the intersection point of the medians of $B C X$. Since $X M$ is a median for both $B C X$ and $A A^{\prime} X$, it follows that $K$ is also the intersection point of the medians of $A A^{\prime} X$. Thus $K$ lies on the median $A Y$. Since the triangle $K A^{\prime} X$ is equilateral, we have $K Y \perp A^{\prime} X$, so $A Y$ is both the height and the median of $A A^{\prime} X$.

Consequently, $T A+T B+T C=A X=A A^{\prime}=2 A M$.


solution:
. Let $A^{\prime}$ be a point such that $A B A^{\prime} C$ is a parallelogram (Figure 5). Use notations $A B=c, A C=b, 2 A M=A A^{\prime}=d, T A=x, T B=y, T C=z$. From $\angle A B T=60^{\circ}-\angle B A T=\angle C A T=60^{\circ}-\angle A C T$ one gets $\triangle A B T \sim \triangle C A T$. So $y: x=c: b$, and we have totally $\triangle A B T \sim \triangle C A T \sim \triangle A^{\prime} A B$, giving $x=b \cdot \frac{c}{d}=c \cdot \frac{b}{d}$, $y=c \cdot \frac{c}{d}, z=b \cdot \frac{b}{d}$. By applying the law of cosines in triangle $A^{\prime} A B$, we finally get

$$
x+y+z=\frac{b c+c^{2}+b^{2}}{d}=\frac{d^{2}}{d}=d .
$$

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-12.jpg?height=505&width=1040&top_left_y=1986&top_left_x=588)

Figure 5


problem:
Let $P_{0}, P_{1}, \ldots, P_{8}=P_{0}$ be successive points on a circle and $Q$ be a point inside the polygon $P_{0} P_{1} \ldots P_{7}$ such that $\angle P_{i-1} Q P_{i}=45^{\circ}$ for $i=1, \ldots, 8$. Prove that the sum

$$
\sum_{i=1}^{8} P_{i-1} P_{i}{ }^{2}
$$

is minimal if and only if $Q$ is the centre of the circle.

solution:
By the cosine law we have (Figure 6)

$$
P_{i-1} P_{i}^{2}=Q P_{i-1}^{2}+Q P_{i}^{2}-\sqrt{2} \cdot Q P_{i-1} \cdot Q P_{i} .
$$

Hence, using the AM-GM inequality,

$$
\sum_{i=1}^{8} P_{i-1} P_{i}^{2}=\sum_{i=1}^{8}\left(2 \cdot Q P_{i}^{2}-\sqrt{2} \cdot Q P_{i-1} \cdot Q P_{i}\right) \geq(2-\sqrt{2}) \sum_{i=1}^{8} Q P_{i}^{2}
$$

The equality holds if and only if all distances $Q P_{i}$ are equally large, i.e. $Q$ is the centre of the circle. So it remains to show that the sum in the last expression is independent of $Q$. Indeed, by the Pythagorean theorem,

$$
\sum_{i=1}^{8} Q P_{i}^{2}=\left(P_{0} P_{2}^{2}+P_{4} P_{6}^{2}\right)+\left(P_{1} P_{3}^{2}+P_{5} P_{7}^{2}\right)=2 d^{2}
$$

where $d$ is the diameter of the circle. The last equality follows form the fact that $P_{0} P_{2} P_{4} P_{6}$ is a cyclic quadrilateral with perpendicular diagonals, so $P_{0} P_{2}{ }^{2}+P_{4} P_{6}{ }^{2}=$ $d^{2}$.

Remark. The sum $\sum_{i=1}^{8} Q P_{i}{ }^{2}=\sum_{i=1}^{4} Q P_{2 i-1}{ }^{2}+\sum_{i=1}^{4} Q P_{2 i}{ }^{2}$ can also be computed easily using coordinates, e.g. expressing each term by the coordinates of $Q$.

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-13.jpg?height=708&width=694&top_left_y=1845&top_left_x=607)

Figure 6

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-14.jpg?height=682&width=666&top_left_y=287&top_left_x=775)

Figure 7

problem_match: # Problem 12


problem: Let $A B C$ be an acute triangle, and let $H$ be its orthocentre. Denote by $H_{A}, H_{B}$ and $H_{C}$ the second intersection of the circumcircle with the altitudes from $A, B$ and $C$ respectively. Prove that the area of $\triangle H_{A} H_{B} H_{C}$ does not exceed the area of $\triangle A B C$.

solution:
. We know that the points $H_{A}, H_{B}$ and $H_{C}$ are in fact the reflection of $H$ on the sides (Figure 7). Since $A B C$ is acute (i.e. $H$ lies in the interior of $A B C$ ), we have $S_{A H_{C} B H_{A} C H_{B}}=2 S_{A B C}$. We thus have to show that $2 S_{H_{A} H_{B} H_{C}} \leq S_{A H_{C} B H_{A} C H_{B}}$, which is equivalent to

$$
S_{H_{A} H_{B} H_{C}} \leq S_{H_{A} C H_{B}}+S_{H_{B} A H_{C}}+S_{H_{C} B H_{A}}
$$

Notice that the triangles on the RHS are isosceles (e.g. $H_{A} C=H C=H_{B} C$ ). If now for example $\angle H_{A} H_{B} H_{C} \geq 90^{\circ}$, then obviously already $S_{H_{A} H_{B} H_{C}} \leq S_{H_{A} B H_{C}}$. It may therefore be supposed that $H_{A} H_{B} H_{C}$ is acute-angled. Denote by $M$ its orthocentre, which then lies inside the triangle. Denote by $M_{A}, M_{B}$ and $M_{C}$ the reflections of the orthocentre on the sides $H_{B} H_{C}, H_{C} H_{A}$ and $H_{A} H_{B}$, respectively. These lie on the circumcircle, and therefore we have $S_{H_{B} M_{A} H_{C}} \leq S_{H_{B} A H_{C}}, S_{H_{C} M_{B} H_{A}} \leq S_{H_{C} B H_{A}}$ and $S_{H_{A} M_{C} H_{B}} \leq S_{H_{A} C H_{B}}$. Since

$$
S_{H_{A} H_{B} H_{C}}=S_{H_{B} M_{A} H_{C}}+S_{H_{C} M_{B} H_{A}}+S_{H_{A} M_{C} H_{B}},
$$

we arrive to the required result.

problem_match: # Problem 13


solution:
. Let the angles of $A B C$ be denoted by $\alpha, \beta$ and $\gamma$, the radius of the circumcircle by $R$. Then

$$
S_{A B C}=2 R^{2} \sin \alpha \sin \beta \sin \gamma
$$

By peripheric angles we get

$$
\angle H_{A} H_{B} H_{C}=\angle H_{A} H_{B} B+\angle B H_{B} H_{C}=\angle H_{A} A B+\angle B C H_{C}=180^{\circ}-2 \beta,
$$

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-15.jpg?height=845&width=946&top_left_y=291&top_left_x=475)

Figure 8

and correspondingly $\angle H_{B} H_{C} H_{A}=180^{\circ}-2 \gamma$ and $\angle H_{C} H_{A} H_{B}=180^{\circ}-2 \alpha$. Thus

$$
\begin{aligned}
& S_{H_{A} H_{B} H_{C}}=2 R^{2} \sin \left(180^{\circ}-2 \beta\right) \sin (\left.180^{\circ}-2 \gamma\right) \sin \left(180^{\circ}-2 \alpha\right) \\
&=2 R^{2} \sin (2 \beta) \sin (2 \gamma) \sin (2 \alpha)=8 S_{A B C} \cos \alpha \cos \beta \cos \gamma \\
& \leq 8 S_{A B C}\left(\frac{\cos \alpha+\cos \beta+\cos \gamma}{3}\right)^{3} \leq S_{A B C}
\end{aligned}
$$

where the last inequality follows from Jensen's inequality for the cosine function.

Remark. There are also other solutions that combine the ideas appearing in Solutions 1 and 2 in different way.


problem: Given a triangle $A B C$, let its incircle touch the sides $B C, C A, A B$ at $D, E, F$, respectively. Let $G$ be the midpoint of the segment $D E$. Prove that $\angle E F C=$ $\angle G F D$.

solution:
. Let $\omega$ be the circumcircle of the triangle $C E F$ and let $H$ be the second point of intersection of the circle $\omega$ with the line $C G$ (Figure 8). Assume also, without loss of generality, that $A C<B C$. (If $A C=B C$, the whole problem becomes trivial due to symmetry.) Then the points $G, H, B$ lie on the same side of the line $C F$ and the vertex $A$ lies on the opposite side. The points $E, F, H, C$ lie on the circle $\omega$ while the points $E$ and $D$ are symmetric with respect to the line $\mathrm{CH}$. Hence

$$
\angle E F C=\angle E H C=\angle C H D .
$$

The line $A C$ is tangent to the incircle of $A B C$ at $E$, so we have $\angle G D F=$ $\angle E D F=\angle A E F=180^{\circ}-\angle C E F$. Now, using the circle $\omega$, we see that $\angle C E F=$

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-16.jpg?height=1025&width=1197&top_left_y=281&top_left_x=515)

Figure 9

$180^{\circ}-\angle C H F=180^{\circ}-\angle G H F$. Combining the above relations we conclude that $\angle G D F=\angle G H F$, so that the points $G, F, H, D$ lie on a circle. Therefore $\angle C H D=$ $\angle G H D=\angle G F D$, which together with $(*)$ proves the assertion of the problem.

Remark. This problem is trivial for those who rely on the following known result: a symmedian through one of the vertices of a triangle passes through the point of intersection of the tangents to the circumcircle at the other two vertices (http://www. cut-the-knot.org/Curriculum/Geometry/Symmedian.shtml\#explanation). Applying this result to triangle $D E F$ and the symmedian through $F$ gives that the symmedian coincides with $F C$. Now use the definition of symmedian.

problem_match: # Problem 14


solution:
. We show that the ray from a triangle vertex $F$ though the intersection $C$ of the tangents to the circumcircle at the two other vertices $D$ and $E$ is the symmedian of triangle $D F E$ : Let the circle with centre $C$ and radius $C D=C E$ meet the rays $F D$ and $F E$ again in $P$ and $Q$ (Figure 9$)$. Then

$$
\angle D P C=\angle P D C=\angle F D B=\angle F E D=180^{\circ}-\angle Q E D=\angle Q P D,
$$

whence $P, C, Q$ are collinear. Thus $P Q$ is a diameter of circle $D E Q P$. Triangles $F D E$ and $F Q P$ are similar and have a common angle at $F$. Consequently, the desired result follows since $G$ is the midpoint of $D E$ and $C$ is the midpoint of $Q P$.


problem:
The circumcentre $O$ of a given cyclic quadrilateral $A B C D$ lies inside the quadrilateral but not on the diagonal $A C$. The diagonals of the quadrilateral intersect at $I$.

The circumcircle of the triangle $A O I$ meets the sides $A D$ and $A B$ at points $P$ and $Q$, respectively; the circumcircle of the triangle $C O I$ meets the sides $C B$ and $C D$ at points $R$ and $S$, respectively. Prove that $P Q R S$ is a parallelogram.

solution:
Assume w.l.o.g. that angle $A B C$ is obtuse (otherwise switch $B$ and $D$, Figure 10). As $A, I, O$ and $P$ are concyclic, we get $\angle Q A I=\angle Q O I$; similarly $\angle R C I=\angle R O I$. Hence

$$
\begin{aligned}
\angle Q O R=\angle Q O I+\angle R O I=\angle Q A I+\angle R C I & =\angle B A C+\angle B C A \\
& =180^{\circ}-\angle A B C=180^{\circ}-\angle Q B R .
\end{aligned}
$$

It follows that points $Q, O, R$ and $B$ are concyclic.

Furthermore, $\angle P A I=180^{\circ}-\angle P O I$ and $\angle S C I=180^{\circ}-\angle S O I$ imply

$$
\begin{aligned}
\angle P O S=360^{\circ}-\angle P O I-\angle S O I=\angle P A I+\angle S C I & =\angle D A C+\angle D C A \\
& =180^{\circ}-\angle A D C=180^{\circ}-\angle P D S .
\end{aligned}
$$

Hence also points $P, O, S$ and $D$ are concyclic.

As $O$ is the circumcentre of $A B C D$, we have $A O=O B$ and $\angle B A O=\angle O B A$. These are inscribed angles in circumcircles of $A P Q$ and $B Q R$, respectively, and both of them are based on the same chord $O Q$. Therefore the radii of these two circumcircles are equal. Similarly, the radii of circumcircles of $B Q R, C R S$ and $D S P$ are also equal.

As $\angle Q A P=\angle B A D=180^{\circ}-\angle B C D=180^{\circ}-\angle R C S$ and radii of the circumcircles of $A Q O P$ and $O R C S$ are equal, the chords $Q P$ and $R S$ have equal lengths; similarly also $Q R$ and $P S$ have equal lengths. Thus $P Q R S$ is a parallelogram.

Remark. In the case of $O$ lying in the diagonal $A C$, the necessary triangles $A O I$ and $C O I$ are degenerate and have no circumcircle. The statement of the problem still holds if the circumcentre of $A B C D$ does not lie inside the quadrilateral (Figure 11) and even if the circumcircles of $A O I$ and $C O I$ meet prolongations of sides.

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-17.jpg?height=663&width=711&top_left_y=1890&top_left_x=227)

Figure 10

![](https://cdn.mathpix.com/cropped/2024_04_17_58afd2ba119b24b9ae91g-17.jpg?height=699&width=713&top_left_y=1855&top_left_x=977)

Figure 11

problem_match: # Problem 15


problem: Let $n, m$ and $k$ be positive integers satisfying $(n-1) n(n+1)=m^{k}$. Prove that $k=1$.

solution: Since $\operatorname{gcd}(n,(n-1)(n+1))=1$, if $(n-1) n(n+1)$ is a $k$-th power for $k \geq 1$, then $n$ and $(n-1)(n+1)=n^{2}-1$ must be $k$-th powers as well. Then $n=m_{1}^{k}$ and $n^{2}-1=m_{2}^{k}=\left(m_{1}^{2}\right)^{k}-1$. But the difference of two positive $k$-th powers can never be 1 , if $k>1$. So $k=1$.

problem_match: # Problem 16


problem:
Let $d(n)$ denote the number of positive divisors of $n$. Find all triples $(n, k, p)$, where $n$ and $k$ are positive integers and $p$ is a prime number, such that

$$
n^{d(n)}-1=p^{k} .
$$

solution:
Note first that $n^{d(n)}$ is always a square: if $d(n)$ is an even number this is clear; but $d(n)$ is odd exactly if $n$ is a square, and then its power $n^{d(n)}$ is also a square.

Let $n^{d(n)}=m^{2}, m>0$. Then

$$
(m+1)(m-1)=m^{2}-1=n^{d(n)}-1=p^{k} .
$$

There is no solution for $m=1$. If $m=2$, we get $(n, k, p)=(2,1,3)$. If $m>2$, we have $m-1, m+1>1$ and because both factors divide $p^{k}$, they are both powers of $p$. The only possibility is $m-1=2, m+1=4$. Hence $m=3$ and $n^{d(n)}=m^{2}=9$. This leads to the solution $(n, k, p)=(3,3,2)$. So the only solutions are $(n, k, p)=(2,1,3)$ and $(n, k, p)=(3,3,2)$.

problem_match: # Problem 17


problem: Find all triples $(a, b, c)$ of integers satisfying $a^{2}+b^{2}+c^{2}=20122012$.

solution:
First consider the equation modulo 4. Since a square can only be congruent to 0 or 1 modulo 4, and 20122012 is divisible by 4, we can conclude that all of $a, b$ and $c$ have to be even. Substituting $a=2 a_{1}, b=2 b_{1}, c=2 c_{1}$ the equation turns into $a_{1}^{2}+b_{1}^{2}+c_{1}^{2}=5030503$.

If we now consider the remaining equation modulo 8 , we can see that the right side is congruent to 7, whilst the only quadratic residues modulo 8 are 0,1 and 4 , and hence the left hand side can never be congruent to 7 .

We therefore conclude that the original equation has no integer solutions.

problem_match: # Problem 18


problem: Show that $n^{n}+(n+1)^{n+1}$ is composite for infinitely many positive integers $n$.

solution: We will show that for any positive integer $n \equiv 4(\bmod 6)$ the number $n^{n}+(n+1)^{n+1}$ is divisible by 3 and hence composite. Indeed, for any such $n$ we have $n \equiv 1(\bmod 3)$ and hence $n^{n}+(n+1)^{n+1} \equiv 1^{n}+2^{n+1}=1+2^{n+1}(\bmod 3)$. Moreover, the exponent $n+1$ is odd, which implies that $2^{n+1} \equiv 2(\bmod 3)$. It follows that $n^{n}+(n+1)^{n+1} \equiv 1+2 \equiv 0(\bmod 3)$, as claimed.

problem_match: # Problem 19


problem: Find all integer solutions of the equation $2 x^{6}+y^{7}=11$.

solution:
There are no solutions. The hardest part of the problem is to determine a modulus $m$ that would yield a contradiction. There should be few sixth and seventh powers modulo $m$, hence, a natural choice is $6 \cdot 7+1=43$. Luckily, it is a prime.

Now, just write out sixth powers $(0,1,4,11,16,21,35,41)$ and seventh powers $(0,1,6,7,36,37,42)$ modulo 43 , and see that they can't be combined to give 11. Indeed,

$$
\begin{aligned}
2 x^{6} \bmod 43 & \in\{0,2,8,22,27,32,39,42\}, \\
11-y^{7} \bmod 43 & \in\{4,5,10,11,12,17,18\},
\end{aligned}
$$

and these sets do not intersect.

Remark. To find the sixth and seventh powers modulo 43, we can note that 3 is a primitive root modulo 43. So the nonzero sixth powers are exactly the powers of $3^{6} \equiv 41 \equiv-2$ and the nonzero seventh powers are the powers of $3^{7} \equiv 37 \equiv-6$ $(\bmod 43)$.

problem_match: # Problem 20