di-zhang-fdu/OlympiadExtended huggingface dataset:
Subfield: Algebra


Question: Let $r$ be a positive integer, and let $a_{0}, a_{1}, \ldots$ be an infinite sequence of real numbers. Assume that for all nonnegative integers $m$ and $s$ there exists a positive integer $n \in[m+1, m+r]$ such that

$$
a_{m}+a_{m+1}+\cdots+a_{m+s}=a_{n}+a_{n+1}+\cdots+a_{n+s}
$$

Prove that the sequence is periodic, i. e. there exists some $p \geqslant 1$ such that $a_{n+p}=a_{n}$ for all $n \geqslant 0$.

Solution:
For every indices $m \leqslant n$ we will denote $S(m, n)=a_{m}+a_{m+1}+\cdots+a_{n-1}$; thus $S(n, n)=0$. Let us start with the following lemma.

Lemma. Let $b_{0}, b_{1}, \ldots$ be an infinite sequence. Assume that for every nonnegative integer $m$ there exists a nonnegative integer $n \in[m+1, m+r]$ such that $b_{m}=b_{n}$. Then for every indices $k \leqslant \ell$ there exists an index $t \in[\ell, \ell+r-1]$ such that $b_{t}=b_{k}$. Moreover, there are at most $r$ distinct numbers among the terms of $\left(b_{i}\right)$.

Proof. To prove the first claim, let us notice that there exists an infinite sequence of indices $k_{1}=k, k_{2}, k_{3}, \ldots$ such that $b_{k_{1}}=b_{k_{2}}=\cdots=b_{k}$ and $k_{i}<k_{i+1} \leqslant k_{i}+r$ for all $i \geqslant 1$. This sequence is unbounded from above, thus it hits each segment of the form $[\ell, \ell+r-1]$ with $\ell \geqslant k$, as required.

To prove the second claim, assume, to the contrary, that there exist $r+1$ distinct numbers $b_{i_{1}}, \ldots, b_{i_{r+1}}$. Let us apply the first claim to $k=i_{1}, \ldots, i_{r+1}$ and $\ell=\max \left\{i_{1}, \ldots, i_{r+1}\right\}$; we obtain that for every $j \in\{1, \ldots, r+1\}$ there exists $t_{j} \in[s, s+r-1]$ such that $b_{t_{j}}=b_{i_{j}}$. Thus the segment $[s, s+r-1]$ should contain $r+1$ distinct integers, which is absurd.

Setting $s=0$ in the problem condition, we see that the sequence $\left(a_{i}\right)$ satisfies the condition of the lemma, thus it attains at most $r$ distinct values. Denote by $A_{i}$ the ordered $r$-tuple $\left(a_{i}, \ldots, a_{i+r-1}\right)$; then among $A_{i}$ 's there are at most $r^{r}$ distinct tuples, so for every $k \geqslant 0$ two of the tuples $A_{k}, A_{k+1}, \ldots, A_{k+r^{r}}$ are identical. This means that there exists a positive integer $p \leqslant r^{r}$ such that the equality $A_{d}=A_{d+p}$ holds infinitely many times. Let $D$ be the set of indices $d$ satisfying this relation.

Now we claim that $D$ coincides with the set of all nonnegative integers. Since $D$ is unbounded, it suffices to show that $d \in D$ whenever $d+1 \in D$. For that, denote $b_{k}=S(k, p+k)$. The sequence $b_{0}, b_{1}, \ldots$ satisfies the lemma conditions, so there exists an index $t \in[d+1, d+r]$ such that $S(t, t+p)=S(d, d+p)$. This last relation rewrites as $S(d, t)=S(d+p, t+p)$. Since $A_{d+1}=A_{d+p+1}$, we have $S(d+1, t)=S(d+p+1, t+p)$, therefore we obtain

$$
a_{d}=S(d, t)-S(d+1, t)=S(d+p, t+p)-S(d+p+1, t+p)=a_{d+p}
$$

and thus $A_{d}=A_{d+p}$, as required.

Finally, we get $A_{d}=A_{d+p}$ for all $d$, so in particular $a_{d}=a_{d+p}$ for all $d$, QED.
Subfield: Geometry


Question: Let $A B C$ be an acute-angled triangle with orthocenter $H$, and let $W$ be a point on side $B C$. Denote by $M$ and $N$ the feet of the altitudes from $B$ and $C$, respectively. Denote by $\omega_{1}$ the circumcircle of $B W N$, and let $X$ be the point on $\omega_{1}$ which is diametrically opposite to $W$. Analogously, denote by $\omega_{2}$ the circumcircle of $C W M$, and let $Y$ be the point on $\omega_{2}$ which is diametrically opposite to $W$. Prove that $X, Y$ and $H$ are collinear.

Solution:
Let $L$ be the foot of the altitude from $A$, and let $Z$ be the second intersection point of circles $\omega_{1}$ and $\omega_{2}$, other than $W$. We show that $X, Y, Z$ and $H$ lie on the same line.

Due to $\angle B N C=\angle B M C=90^{\circ}$, the points $B, C, N$ and $M$ are concyclic; denote their circle by $\omega_{3}$. Observe that the line $W Z$ is the radical axis of $\omega_{1}$ and $\omega_{2}$; similarly, $B N$ is the radical axis of $\omega_{1}$ and $\omega_{3}$, and $C M$ is the radical axis of $\omega_{2}$ and $\omega_{3}$. Hence $A=B N \cap C M$ is the radical center of the three circles, and therefore $W Z$ passes through $A$.

Since $W X$ and $W Y$ are diameters in $\omega_{1}$ and $\omega_{2}$, respectively, we have $\angle W Z X=\angle W Z Y=90^{\circ}$, so the points $X$ and $Y$ lie on the line through $Z$, perpendicular to $W Z$.

<img_3183>

The quadrilateral $B L H N$ is cyclic, because it has two opposite right angles. From the power of $A$ with respect to the circles $\omega_{1}$ and $B L H N$ we find $A L \cdot A H=A B \cdot A N=A W \cdot A Z$. If $H$ lies on the line $A W$ then this implies $H=Z$ immediately. Otherwise, by $\frac{A Z}{A H}=\frac{A L}{A W}$ the triangles $A H Z$ and $A W L$ are similar. Then $\angle H Z A=\angle W L A=90^{\circ}$, so the point $H$ also lies on the line $X Y Z$.
Subfield: Geometry


Question: Let $\omega$ be the circumcircle of a triangle $A B C$. Denote by $M$ and $N$ the midpoints of the sides $A B$ and $A C$, respectively, and denote by $T$ the midpoint of the $\operatorname{arc} B C$ of $\omega$ not containing $A$. The circumcircles of the triangles $A M T$ and $A N T$ intersect the perpendicular bisectors of $A C$ and $A B$ at points $X$ and $Y$, respectively; assume that $X$ and $Y$ lie inside the triangle $A B C$. The lines $M N$ and $X Y$ intersect at $K$. Prove that $K A=K T$.

Solution:
Let $O$ be the center of $\omega$, thus $O=M Y \cap N X$. Let $\ell$ be the perpendicular bisector of $A T$ (it also passes through $O$ ). Denote by $r$ the operation of reflection about $\ell$. Since $A T$ is the angle bisector of $\angle B A C$, the line $r(A B)$ is parallel to $A C$. Since $O M \perp A B$ and $O N \perp A C$, this means that the line $r(O M)$ is parallel to the line $O N$ and passes through $O$, so $r(O M)=O N$. Finally, the circumcircle $\gamma$ of the triangle $A M T$ is symmetric about $\ell$, so $r(\gamma)=\gamma$. Thus the point $M$ maps to the common point of $O N$ with the $\operatorname{arc} A M T$ of $\gamma$ - that is, $r(M)=X$.

Similarly, $r(N)=Y$. Thus, we get $r(M N)=X Y$, and the common point $K$ of $M N$ nd $X Y$ lies on $\ell$. This means exactly that $K A=K T$.

<img_3674>
Let $L$ be the second common point of the line $A C$ with the circumcircle $\gamma$ of the triangle $A M T$. From the cyclic quadrilaterals $A B T C$ and $A M T L$ we get $\angle B T C=180^{\circ}-$ $\angle B A C=\angle M T L$, which implies $\angle B T M=\angle C T L$. Since $A T$ is an angle bisector in these quadrilaterals, we have $B T=T C$ and $M T=T L$. Thus the triangles $B T M$ and $C T L$ are congruent, so $C L=B M=A M$.

Let $X^{\prime}$ be the common point of the line $N X$ with the external bisector of $\angle B A C$; notice that it lies outside the triangle $A B C$. Then we have $\angle T A X^{\prime}=90^{\circ}$ and $X^{\prime} A=X^{\prime} C$, so we get $\angle X^{\prime} A M=90^{\circ}+\angle B A C / 2=180^{\circ}-\angle X^{\prime} A C=180^{\circ}-\angle X^{\prime} C A=\angle X^{\prime} C L$. Thus the triangles $X^{\prime} A M$ and $X^{\prime} C L$ are congruent, and therefore

$$
\angle M X^{\prime} L=\angle A X^{\prime} C+\left(\angle C X^{\prime} L-\angle A X^{\prime} M\right)=\angle A X^{\prime} C=180^{\circ}-2 \angle X^{\prime} A C=\angle B A C=\angle M A L .
$$

This means that $X^{\prime}$ lies on $\gamma$.

Thus we have $\angle T X N=\angle T X X^{\prime}=\angle T A X^{\prime}=90^{\circ}$, so $T X \| A C$. Then $\angle X T A=\angle T A C=$ $\angle T A M$, so the cyclic quadrilateral $M A T X$ is an isosceles trapezoid. Similarly, $N A T Y$ is an isosceles trapezoid, so again the lines $M N$ and $X Y$ are the reflections of each other about the perpendicular bisector of $A T$. Thus $K$ belongs to this perpendicular bisector.



<img_3314>
Subfield: Number Theory


Question: Let $\mathbb{Z}_{>0}$ be the set of positive integers. Find all functions $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ such that

$$
m^{2}+f(n) \mid m f(m)+n
$$

for all positive integers $m$ and $n$.

Solution:
Setting $m=n=2$ tells us that $4+f(2) \mid 2 f(2)+2$. Since $2 f(2)+2<2(4+f(2))$, we must have $2 f(2)+2=4+f(2)$, so $f(2)=2$. Plugging in $m=2$ then tells us that $4+f(n) \mid 4+n$, which implies that $f(n) \leqslant n$ for all $n$.

Setting $m=n$ gives $n^{2}+f(n) \mid n f(n)+n$, so $n f(n)+n \geqslant n^{2}+f(n)$ which we rewrite as $(n-1)(f(n)-n) \geqslant 0$. Therefore $f(n) \geqslant n$ for all $n \geqslant 2$. This is trivially true for $n=1$ also.

It follows that $f(n)=n$ for all $n$. This function obviously satisfies the desired property.
Setting $m=f(n)$ we get $f(n)(f(n)+1) \mid f(n) f(f(n))+n$. This implies that $f(n) \mid n$ for all $n$.

Now let $m$ be any positive integer, and let $p>2 m^{2}$ be a prime number. Note that $p>m f(m)$ also. Plugging in $n=p-m f(m)$ we learn that $m^{2}+f(n)$ divides $p$. Since $m^{2}+f(n)$ cannot equal 1, it must equal $p$. Therefore $p-m^{2}=f(n) \mid n=p-m f(m)$. But $p-m f(m)<p<2\left(p-m^{2}\right)$, so we must have $p-m f(m)=p-m^{2}$, i.e., $f(m)=m$.
Plugging $m=1$ we obtain $1+f(n) \leqslant f(1)+n$, so $f(n) \leqslant n+c$ for the constant $c=$ $f(1)-1$. Assume that $f(n) \neq n$ for some fixed $n$. When $m$ is large enough (e.g. $m \geqslant \max (n, c+1)$ ) we have

$$
m f(m)+n \leqslant m(m+c)+n \leqslant 2 m^{2}<2\left(m^{2}+f(n)\right)
$$

so we must have $m f(m)+n=m^{2}+f(n)$. This implies that

$$
0 \neq f(n)-n=m(f(m)-m)
$$

which is impossible for $m>|f(n)-n|$. It follows that $f$ is the identity function.

Final answer: $f(n)=n$
Subfield: Number Theory


Question: Prove that there exist infinitely many positive integers $n$ such that the largest prime divisor of $n^{4}+n^{2}+1$ is equal to the largest prime divisor of $(n+1)^{4}+(n+1)^{2}+1$.

Solution:
Let $p_{n}$ be the largest prime divisor of $n^{4}+n^{2}+1$ and let $q_{n}$ be the largest prime divisor of $n^{2}+n+1$. Then $p_{n}=q_{n^{2}}$, and from

$$
n^{4}+n^{2}+1=\left(n^{2}+1\right)^{2}-n^{2}=\left(n^{2}-n+1\right)\left(n^{2}+n+1\right)=\left((n-1)^{2}+(n-1)+1\right)\left(n^{2}+n+1\right)
$$

it follows that $p_{n}=\max \left\{q_{n}, q_{n-1}\right\}$ for $n \geqslant 2$. Keeping in mind that $n^{2}-n+1$ is odd, we have

$$
\operatorname{gcd}\left(n^{2}+n+1, n^{2}-n+1\right)=\operatorname{gcd}\left(2 n, n^{2}-n+1\right)=\operatorname{gcd}\left(n, n^{2}-n+1\right)=1
$$

Therefore $q_{n} \neq q_{n-1}$.

To prove the result, it suffices to show that the set

$$
S=\left\{n \in \mathbb{Z}_{\geqslant 2} \mid q_{n}>q_{n-1} \text { and } q_{n}>q_{n+1}\right\}
$$

is infinite, since for each $n \in S$ one has

$$
p_{n}=\max \left\{q_{n}, q_{n-1}\right\}=q_{n}=\max \left\{q_{n}, q_{n+1}\right\}=p_{n+1}
$$

Suppose on the contrary that $S$ is finite. Since $q_{2}=7<13=q_{3}$ and $q_{3}=13>7=q_{4}$, the set $S$ is non-empty. Since it is finite, we can consider its largest element, say $m$.

Note that it is impossible that $q_{m}>q_{m+1}>q_{m+2}>\ldots$ because all these numbers are positive integers, so there exists a $k \geqslant m$ such that $q_{k}<q_{k+1}$ (recall that $q_{k} \neq q_{k+1}$ ). Next observe that it is impossible to have $q_{k}<q_{k+1}<q_{k+2}<\ldots$, because $q_{(k+1)^{2}}=p_{k+1}=\max \left\{q_{k}, q_{k+1}\right\}=q_{k+1}$, so let us take the smallest $\ell \geqslant k+1$ such that $q_{\ell}>q_{\ell+1}$. By the minimality of $\ell$ we have $q_{\ell-1}<q_{\ell}$, so $\ell \in S$. Since $\ell \geqslant k+1>k \geqslant m$, this contradicts the maximality of $m$, and hence $S$ is indeed infinite.
Subfield: Algebra


Question: Find the largest possible integer $k$, such that the following statement is true:

Let 2009 arbitrary non-degenerated triangles be given. In every triangle the three sides are colored, such that one is blue, one is red and one is white. Now, for every color separately, let us sort the lengths of the sides. We obtain

$$
\begin{aligned}
b_{1} \leq b_{2} \leq \ldots \leq b_{2009} & \text { the lengths of the blue sides } \\
r_{1} \leq r_{2} \leq \ldots \leq r_{2009} & \text { the lengths of the red sides, } \\
\text { and } \quad & w_{1} \leq w_{2} \leq \ldots \leq w_{2009} \quad \text { the lengths of the white sides. }
\end{aligned}
$$

Then there exist $k$ indices $j$ such that we can form a non-degenerated triangle with side lengths $b_{j}, r_{j}, w_{j}$.

Solution:
We will prove that the largest possible number $k$ of indices satisfying the given condition is one.

Firstly we prove that $b_{2009}, r_{2009}, w_{2009}$ are always lengths of the sides of a triangle. Without loss of generality we may assume that $w_{2009} \geq r_{2009} \geq b_{2009}$. We show that the inequality $b_{2009}+r_{2009}>w_{2009}$ holds. Evidently, there exists a triangle with side lengths $w, b, r$ for the white, blue and red side, respectively, such that $w_{2009}=w$. By the conditions of the problem we have $b+r>w, b_{2009} \geq b$ and $r_{2009} \geq r$. From these inequalities it follows

$$
b_{2009}+r_{2009} \geq b+r>w=w_{2009}
$$

Secondly we will describe a sequence of triangles for which $w_{j}, b_{j}, r_{j}$ with $j<2009$ are not the lengths of the sides of a triangle. Let us define the sequence $\Delta_{j}, j=1,2, \ldots, 2009$, of triangles, where $\Delta_{j}$ has

a blue side of length $2 j$,

a red side of length $j$ for all $j \leq 2008$ and 4018 for $j=2009$,

and a white side of length $j+1$ for all $j \leq 2007,4018$ for $j=2008$ and 1 for $j=2009$. Since

$$
\begin{aligned}
(j+1)+j>2 j & \geq j+1>j, & & \text { if } \quad j \leq 2007 \\
2 j+j>4018 & >2 j \quad>j, & & \text { if } j=2008, \\
4018+1>2 j & =4018>1, & & \text { if } j=2009
\end{aligned}
$$

such a sequence of triangles exists. Moreover, $w_{j}=j, r_{j}=j$ and $b_{j}=2 j$ for $1 \leq j \leq 2008$. Then

$$
w_{j}+r_{j}=j+j=2 j=b_{j},
$$

i.e., $b_{j}, r_{j}$ and $w_{j}$ are not the lengths of the sides of a triangle for $1 \leq j \leq 2008$.

Final answer: 1
Subfield: Algebra


Question: Determine all functions $f$ from the set of positive integers into the set of positive integers such that for all $x$ and $y$ there exists a non degenerated triangle with sides of lengths

$$
x, \quad f(y) \text { and } f(y+f(x)-1) .
$$

Solution:
The identity function $f(x)=x$ is the only solution of the problem.

If $f(x)=x$ for all positive integers $x$, the given three lengths are $x, y=f(y)$ and $z=$ $f(y+f(x)-1)=x+y-1$. Because of $x \geq 1, y \geq 1$ we have $z \geq \max \{x, y\}>|x-y|$ and $z<x+y$. From this it follows that a triangle with these side lengths exists and does not degenerate. We prove in several steps that there is no other solution.

Step 1. We show $f(1)=1$.

If we had $f(1)=1+m>1$ we would conclude $f(y)=f(y+m)$ for all $y$ considering the triangle with the side lengths $1, f(y)$ and $f(y+m)$. Thus, $f$ would be $m$-periodic and, consequently, bounded. Let $B$ be a bound, $f(x) \leq B$. If we choose $x>2 B$ we obtain the contradiction $x>2 B \geq f(y)+f(y+f(x)-1)$.

Step 2. For all positive integers $z$, we have $f(f(z))=z$.

Setting $x=z$ and $y=1$ this follows immediately from Step 1 .

Step 3. For all integers $z \geq 1$, we have $f(z) \leq z$.

Let us show, that the contrary leads to a contradiction. Assume $w+1=f(z)>z$ for some $z$. From Step 1 we know that $w \geq z \geq 2$. Let $M=\max \{f(1), f(2), \ldots, f(w)\}$ be the largest value of $f$ for the first $w$ integers. First we show, that no positive integer $t$ exists with

$$
f(t)>\frac{z-1}{w} \cdot t+M,
\tag{1}
$$

otherwise we decompose the smallest value $t$ as $t=w r+s$ where $r$ is an integer and $1 \leq s \leq w$. Because of the definition of $M$, we have $t>w$. Setting $x=z$ and $y=t-w$ we get from the triangle inequality

$$
z+f(t-w)>f((t-w)+f(z)-1)=f(t-w+w)=f(t)
$$

Hence,

$$
f(t-w) \geq f(t)-(z-1)>\frac{z-1}{w}(t-w)+M
$$

a contradiction to the minimality of $t$.

Therefore the inequality (1) fails for all $t \geq 1$, we have proven

$$
f(t) \leq \frac{z-1}{w} \cdot t+M
\tag{2}
$$

instead.



Now, using (2), we finish the proof of Step 3. Because of $z \leq w$ we have $\frac{z-1}{w}<1$ and we can choose an integer $t$ sufficiently large to fulfill the condition

$$
\left(\frac{z-1}{w}\right)^{2} t+\left(\frac{z-1}{w}+1\right) M<t .
$$

Applying (2) twice we get

$$
f(f(t)) \leq \frac{z-1}{w} f(t)+M \leq \frac{z-1}{w}\left(\frac{z-1}{w} t+M\right)+M<t
$$

in contradiction to Step 2, which proves Step 3.

Final step. Thus, following Step 2 and Step 3, we obtain

$$
z=f(f(z)) \leq f(z) \leq z
$$

and $f(z)=z$ for all positive integers $z$ is proven.

Final answer: $f(z)=z$
Subfield: Algebra


Question: Let $a, b, c$ be positive real numbers such that $a b+b c+c a \leq 3 a b c$. Prove that

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

Solution:
Starting with the terms of the right-hand side, the quadratic-arithmetic-mean inequality yields

$$
\begin{aligned}
\sqrt{2} \sqrt{a+b} & =2 \sqrt{\frac{a b}{a+b}} \sqrt{\frac{1}{2}\left(2+\frac{a^{2}+b^{2}}{a b}\right)} \\
& \geq 2 \sqrt{\frac{a b}{a+b}} \cdot \frac{1}{2}\left(\sqrt{2}+\sqrt{\frac{a^{2}+b^{2}}{a b}}\right)=\sqrt{\frac{2 a b}{a+b}}+\sqrt{\frac{a^{2}+b^{2}}{a+b}}
\end{aligned}
$$

and, analogously,

$$
\sqrt{2} \sqrt{b+c} \geq \sqrt{\frac{2 b c}{b+c}}+\sqrt{\frac{b^{2}+c^{2}}{b+c}}, \quad \sqrt{2} \sqrt{c+a} \geq \sqrt{\frac{2 c a}{c+a}}+\sqrt{\frac{c^{2}+a^{2}}{c+a}}
$$

Applying the inequality between the arithmetic mean and the squared harmonic mean will finish the proof:

$$
\sqrt{\frac{2 a b}{a+b}}+\sqrt{\frac{2 b c}{b+c}}+\sqrt{\frac{2 c a}{c+a}} \geq 3 \cdot \sqrt{\frac{3}{\sqrt{\frac{a+b}{2 a b}}^{2}}+\sqrt{\frac{b+c}{2 b c}}+\sqrt{\frac{c+a}{2 c a}}^{2}}=3 \cdot \sqrt{\frac{3 a b c}{a b+b c+c a}} \geq 3
$$
Subfield: Combinatorics


Question: Consider 2009 cards, each having one gold side and one black side, lying in parallel on a long table. Initially all cards show their gold sides. Two players, standing by the same long side of the table, play a game with alternating moves. Each move consists of choosing a block of 50 consecutive cards, the leftmost of which is showing gold, and turning them all over, so those which showed gold now show black and vice versa. The last player who can make a legal move wins.
Does the game necessarily end?

Solution:
We interpret a card showing black as the digit 0 and a card showing gold as the digit 1. Thus each position of the 2009 cards, read from left to right, corresponds bijectively to a nonnegative integer written in binary notation of 2009 digits, where leading zeros are allowed. Each move decreases this integer, so the game must end.
Subfield: Combinatorics


Question: Consider 2009 cards, each having one gold side and one black side, lying in parallel on a long table. Initially all cards show their gold sides. Two players, standing by the same long side of the table, play a game with alternating moves. Each move consists of choosing a block of 50 consecutive cards, the leftmost of which is showing gold, and turning them all over, so those which showed gold now show black and vice versa. The last player who can make a legal move wins.
Does there exist a winning strategy for the starting player?

Solution:
We show that there is no winning strategy for the starting player. We label the cards from right to left by $1, \ldots, 2009$ and consider the set $S$ of cards with labels $50 i, i=1,2, \ldots, 40$. Let $g_{n}$ be the number of cards from $S$ showing gold after $n$ moves. Obviously, $g_{0}=40$. Moreover, $\left|g_{n}-g_{n+1}\right|=1$ as long as the play goes on. Thus, after an odd number of moves, the nonstarting player finds a card from $S$ showing gold and hence can make a move. Consequently, this player always wins.
Subfield: Combinatorics


Question: For any integer $n \geq 2$, let $N(n)$ be the maximal number of triples $\left(a_{i}, b_{i}, c_{i}\right), i=1, \ldots, N(n)$, consisting of nonnegative integers $a_{i}, b_{i}$ and $c_{i}$ such that the following two conditions are satisfied:

(1) $a_{i}+b_{i}+c_{i}=n$ for all $i=1, \ldots, N(n)$,

(2) If $i \neq j$, then $a_{i} \neq a_{j}, b_{i} \neq b_{j}$ and $c_{i} \neq c_{j}$.

Determine $N(n)$ for all $n \geq 2$.

Solution:
Let $n \geq 2$ be an integer and let $\left\{T_{1}, \ldots, T_{N}\right\}$ be any set of triples of nonnegative integers satisfying the conditions (1) and (2). Since the $a$-coordinates are pairwise distinct we have

$$
\sum_{i=1}^{N} a_{i} \geq \sum_{i=1}^{N}(i-1)=\frac{N(N-1)}{2}
$$

Analogously,

$$
\sum_{i=1}^{N} b_{i} \geq \frac{N(N-1)}{2} \text { and } \quad \sum_{i=1}^{N} c_{i} \geq \frac{N(N-1)}{2}
$$

Summing these three inequalities and applying (1) yields

$$
3 \frac{N(N-1)}{2} \leq \sum_{i=1}^{N} a_{i}+\sum_{i=1}^{N} b_{i}+\sum_{i=1}^{N} c_{i}=\sum_{i=1}^{N}\left(a_{i}+b_{i}+c_{i}\right)=n N
$$

hence $3 \frac{N-1}{2} \leq n$ and, consequently,

$$
N \leq\left\lfloor\frac{2 n}{3}\right\rfloor+1
$$

By constructing examples, we show that this upper bound can be attained, so $N(n)=\left\lfloor\frac{2 n}{3}\right\rfloor+1$.


We distinguish the cases $n=3 k-1, n=3 k$ and $n=3 k+1$ for $k \geq 1$ and present the extremal examples in form of a table.

| $n=3 k-1$ |  |  |
| :---: | :---: | :---: |
| $\left\lfloor\frac{2 n}{3}\right\rfloor+1=2 k$ |  |  |
| $a_{i}$ | $b_{i}$ | $c_{i}$ |
| 0 | $k+1$ | $2 k-2$ |
| 1 | $k+2$ | $2 k-4$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $k-1$ | $2 k$ | 0 |
| $k$ | 0 | $2 k-1$ |
| $k+1$ | 1 | $2 k-3$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $2 k-1$ | $k-1$ | 1 |


| $n=3 k$ |  |  |
| :---: | :---: | :---: |
| $\left\lfloor\frac{2 n}{3}\right\rfloor+1=2 k+1$ |  |  |
| $a_{i}$ | $b_{i}$ | $c_{i}$ |
| 0 | $k$ | $2 k$ |
| 1 | $k+1$ | $2 k-2$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $k$ | $2 k$ | 0 |
| $k+1$ | 0 | $2 k-1$ |
| $k+2$ | 1 | $2 k-3$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $2 k$ | $k-1$ | 1 |


|  | $=3 k$ |  |
| :---: | :---: | :---: |
| $\frac{2 n}{3}$ | $+1=$ | $k+1$ |
| $a_{i}$ | $b_{i}$ | $c_{i}$ |
| 0 | $k$ | $2 k+1$ |
| 1 | $k+1$ | $2 k-1$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $k$ | $2 k$ | 1 |
| $k+1$ | 0 | $2 k$ |
| $k+2$ | 1 | $2 k-2$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $2 k$ | $k-1$ | 2 |

It can be easily seen that the conditions (1) and (2) are satisfied and that we indeed have $\left\lfloor\frac{2 n}{3}\right\rfloor+1$ triples in each case.

Final answer: $N(n)=\left\lfloor\frac{2 n}{3}\right\rfloor+1$