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


Question: A hunter and an invisible rabbit play a game on an infinite square grid. First the hunter fixes a colouring of the cells with finitely many colours. The rabbit then secretly chooses a cell to start in. Every minute, the rabbit reports the colour of its current cell to the hunter, and then secretly moves to an adjacent cell that it has not visited before (two cells are adjacent if they share a side). The hunter wins if after some finite time either

- the rabbit cannot move; or
- the hunter can determine the cell in which the rabbit started.

Decide whether there exists a winning strategy for the hunter.

Solution:
A central idea is that several colourings $C_{1}, C_{2}, \ldots, C_{k}$ can be merged together into a single product colouring $C_{1} \times C_{2} \times \cdots \times C_{k}$ as follows: the colours in the product colouring are ordered tuples $\left(c_{1}, \ldots, c_{n}\right)$ of colours, where $c_{i}$ is a colour used in $C_{i}$, so that each cell gets a tuple consisting of its colours in the individual colourings $C_{i}$. This way, any information which can be determined from one of the individual colourings can also be determined from the product colouring.

Now let the hunter merge the following colourings:

- The first two colourings $C_{1}$ and $C_{2}$ allow the tracking of the horizontal and vertical movements of the rabbit.

The colouring $C_{1}$ colours the cells according to the residue of their $x$-coordinates modulo 3 , which allows to determine whether the rabbit moves left, moves right, or moves vertically. Similarly, the colouring $C_{2}$ uses the residues of the $y$-coordinates modulo 3 , which allows to determine whether the rabbit moves up, moves down, or moves horizontally.

- Under the condition that the rabbit's $x$-coordinate is unbounded, colouring $C_{3}$ allows to determine the exact value of the $x$-coordinate:

In $C_{3}$, the columns are coloured white and black so that the gaps between neighboring black columns are pairwise distinct. As the rabbit's $x$-coordinate is unbounded, it will eventually visit two black cells in distinct columns. With the help of colouring $C_{1}$ the hunter can catch that moment, and determine the difference of $x$-coordinates of those two black cells, hence deducing the precise column.

Symmetrically, under the condition that the rabbit's $y$-coordinate is unbounded, there is a colouring $C_{4}$ that allows the hunter to determine the exact value of the $y$-coordinate.

- Finally, under the condition that the sum $x+y$ of the rabbit's coordinates is unbounded, colouring $C_{5}$ allows to determine the exact value of this sum: The diagonal lines $x+y=$ const are coloured black and white, so that the gaps between neighboring black diagonals are pairwise distinct.

Unless the rabbit gets stuck, at least two of the three values $x, y$ and $x+y$ must be unbounded as the rabbit keeps moving. Hence the hunter can eventually determine two of these three values; thus he does know all three. Finally the hunter works backwards with help of the colourings $C_{1}$ and $C_{2}$ and computes the starting cell of the rabbit.
Subfield: Combinatorics


Question: Consider a checkered $3 m \times 3 m$ square, where $m$ is an integer greater than 1 . A frog sits on the lower left corner cell $S$ and wants to get to the upper right corner cell $F$. The frog can hop from any cell to either the next cell to the right or the next cell upwards.

Some cells can be sticky, and the frog gets trapped once it hops on such a cell. A set $X$ of cells is called blocking if the frog cannot reach $F$ from $S$ when all the cells of $X$ are sticky. A blocking set is minimal if it does not contain a smaller blocking set.
(a) Prove that there exists a minimal blocking set containing at least $3 m^{2}-3 m$ cells.

Solution:
In the following example the square is divided into $m$ stripes of size $3 \times 3 \mathrm{~m}$. It is easy to see that $X$ is a minimal blocking set. The first and the last stripe each contains $3 m-1$ cells from the set $X$; every other stripe contains $3 m-2$ cells, see Figure 1 . The total number of cells in the set $X$ is $3 m^{2}-2 m+2$.

<img_3356>

Figure 1
Subfield: Geometry


Question: Let $A B C D$ be a convex quadrilateral circumscribed around a circle with centre $I$. Let $\omega$ be the circumcircle of the triangle $A C I$. The extensions of $B A$ and $B C$ beyond $A$ and $C$ meet $\omega$ at $X$ and $Z$, respectively. The extensions of $A D$ and $C D$ beyond $D$ meet $\omega$ at $Y$ and $T$, respectively. Prove that the perimeters of the (possibly self-intersecting) quadrilaterals $A D T X$ and $C D Y Z$ are equal.

Solution:
The point $I$ is the intersection of the external bisector of the angle $T C Z$ with the circumcircle $\omega$ of the triangle $T C Z$, so $I$ is the midpoint of the $\operatorname{arc} T C Z$ and $I T=I Z$. Similarly, $I$ is the midpoint of the $\operatorname{arc} Y A X$ and $I X=I Y$. Let $O$ be the centre of $\omega$. Then $X$ and $T$ are the reflections of $Y$ and $Z$ in $I O$, respectively. So $X T=Y Z$.

<img_3499>

Let the incircle of $A B C D$ touch $A B, B C, C D$, and $D A$ at points $P, Q, R$, and $S$, respectively.

The right triangles $I X P$ and $I Y S$ are congruent, since $I P=I S$ and $I X=I Y$. Similarly, the right triangles $I R T$ and $I Q Z$ are congruent. Therefore, $X P=Y S$ and $R T=Q Z$.

Denote the perimeters of $A D T X$ and $C D Y Z$ by $P_{A D T X}$ and $P_{C D Y Z}$ respectively. Since $A S=A P, C Q=R C$, and $S D=D R$, we obtain

$$
\begin{aligned}
P_{A D T X}=X T+X A+A S+ & S D+D T=X T+X P+R T \\
& =Y Z+Y S+Q Z=Y Z+Y D+D R+R C+C Z=P_{C D Y Z}
\end{aligned}
$$

as required.
Subfield: Number Theory


Question: Determine all integers $n \geqslant 1$ for which there exists a pair of positive integers $(a, b)$ such that no cube of a prime divides $a^{2}+b+3$ and

$$
\frac{a b+3 b+8}{a^{2}+b+3}=n
$$

Solution:
As $b \equiv-a^{2}-3\left(\bmod a^{2}+b+3\right)$, the numerator of the given fraction satisfies

$$
a b+3 b+8 \equiv a\left(-a^{2}-3\right)+3\left(-a^{2}-3\right)+8 \equiv-(a+1)^{3} \quad\left(\bmod a^{2}+b+3\right)
$$

As $a^{2}+b+3$ is not divisible by $p^{3}$ for any prime $p$, if $a^{2}+b+3$ divides $(a+1)^{3}$ then it does also divide $(a+1)^{2}$. Since

$$
0<(a+1)^{2}<2\left(a^{2}+b+3\right)
$$

we conclude $(a+1)^{2}=a^{2}+b+3$. This yields $b=2(a-1)$ and $n=2$. The choice $(a, b)=(2,2)$ with $a^{2}+b+3=9$ shows that $n=2$ indeed is a solution.

Final answer: 2
Subfield: Number Theory


Question: Let $n \geqslant 100$ be an integer. The numbers $n, n+1, \ldots, 2 n$ are written on $n+1$ cards, one number per card. The cards are shuffled and divided into two piles. Prove that one of the piles contains two cards such that the sum of their numbers is a perfect square.

Solution:
To solve the problem it suffices to find three squares and three cards with numbers $a, b, c$ on them such that pairwise sums $a+b, b+c, a+c$ are equal to the chosen squares. By choosing the three consecutive squares $(2 k-1)^{2},(2 k)^{2},(2 k+1)^{2}$ we arrive at the triple

$$
(a, b, c)=\left(2 k^{2}-4 k, \quad 2 k^{2}+1, \quad 2 k^{2}+4 k\right)
$$

We need a value for $k$ such that

$$
n \leqslant 2 k^{2}-4 k, \quad \text { and } \quad 2 k^{2}+4 k \leqslant 2 n \text {. }
$$

A concrete $k$ is suitable for all $n$ with

$$
n \in\left[k^{2}+2 k, 2 k^{2}-4 k+1\right]=: I_{k} .
$$

For $k \geqslant 9$ the intervals $I_{k}$ and $I_{k+1}$ overlap because

$$
(k+1)^{2}+2(k+1) \leqslant 2 k^{2}-4 k+1 .
$$

Hence $I_{9} \cup I_{10} \cup \ldots=[99, \infty)$, which proves the statement for $n \geqslant 99$.
Subfield: Number Theory


Question: Find all positive integers $n$ with the following property: the $k$ positive divisors of $n$ have a permutation $\left(d_{1}, d_{2}, \ldots, d_{k}\right)$ such that for every $i=1,2, \ldots, k$, the number $d_{1}+\cdots+d_{i}$ is a perfect square.

Solution:
For $i=1,2, \ldots, k$ let $d_{1}+\ldots+d_{i}=s_{i}^{2}$, and define $s_{0}=0$ as well. Obviously $0=s_{0}<s_{1}<s_{2}<\ldots<s_{k}$, so

$$
s_{i} \geqslant i \quad \text { and } \quad d_{i}=s_{i}^{2}-s_{i-1}^{2}=\left(s_{i}+s_{i-1}\right)\left(s_{i}-s_{i-1}\right) \geqslant s_{i}+s_{i-1} \geqslant 2 i-1
\tag{1}
$$

The number 1 is one of the divisors $d_{1}, \ldots, d_{k}$ but, due to $d_{i} \geqslant 2 i-1$, the only possibility is $d_{1}=1$.

Now consider $d_{2}$ and $s_{2} \geqslant 2$. By definition, $d_{2}=s_{2}^{2}-1=\left(s_{2}-1\right)\left(s_{2}+1\right)$, so the numbers $s_{2}-1$ and $s_{2}+1$ are divisors of $n$. In particular, there is some index $j$ such that $d_{j}=s_{2}+1$.

Notice that

$$
s_{2}+s_{1}=s_{2}+1=d_{j} \geqslant s_{j}+s_{j-1} ;
\tag{2}
$$

since the sequence $s_{0}<s_{1}<\ldots<s_{k}$ increases, the index $j$ cannot be greater than 2. Hence, the divisors $s_{2}-1$ and $s_{2}+1$ are listed among $d_{1}$ and $d_{2}$. That means $s_{2}-1=d_{1}=1$ and $s_{2}+1=d_{2} ;$ therefore $s_{2}=2$ and $d_{2}=3$.

We can repeat the above process in general.

Claim. $d_{i}=2 i-1$ and $s_{i}=i$ for $i=1,2, \ldots, k$.

Proof. Apply induction on $i$. The Claim has been proved for $i=1,2$. Suppose that we have already proved $d=1, d_{2}=3, \ldots, d_{i}=2 i-1$, and consider the next divisor $d_{i+1}$ :

$$
d_{i+1}=s_{i+1}^{2}-s_{i}^{2}=s_{i+1}^{2}-i^{2}=\left(s_{i+1}-i\right)\left(s_{i+1}+i\right)
$$

The number $s_{i+1}+i$ is a divisor of $n$, so there is some index $j$ such that $d_{j}=s_{i+1}+i$.

Similarly to (2), by (1) we have

$$
s_{i+1}+s_{i}=s_{i+1}+i=d_{j} \geqslant s_{j}+s_{j-1}
\tag{3}
$$

since the sequence $s_{0}<s_{1}<\ldots<s_{k}$ increases, (3) forces $j \leqslant i+1$. On the other hand, $d_{j}=s_{i+1}+i>2 i>d_{i}>d_{i-1}>\ldots>d_{1}$, so $j \leqslant i$ is not possible. The only possibility is $j=i+1$.

Hence,

$$
\begin{gathered}
s_{i+1}+i=d_{i+1}=s_{i+1}^{2}-s_{i}^{2}=s_{i+1}^{2}-i^{2} \\
s_{i+1}^{2}-s_{i+1}=i(i+1) .
\end{gathered}
$$

By solving this equation we get $s_{i+1}=i+1$ and $d_{i+1}=2 i+1$, that finishes the proof.

Now we know that the positive divisors of the number $n$ are $1,3,5, \ldots, n-2, n$. The greatest divisor is $d_{k}=2 k-1=n$ itself, so $n$ must be odd. The second greatest divisor is $d_{k-1}=n-2$; then $n-2$ divides $n=(n-2)+2$, so $n-2$ divides 2 . Therefore, $n$ must be 1 or 3 .

The numbers $n=1$ and $n=3$ obviously satisfy the requirements: for $n=1$ we have $k=1$ and $d_{1}=1^{2}$; for $n=3$ we have $k=2, d_{1}=1^{2}$ and $d_{1}+d_{2}=1+3=2^{2}$.

Final answer: 1,3
Subfield: Number Theory


Question: Prove that there are only finitely many quadruples $(a, b, c, n)$ of positive integers such that

$$
n !=a^{n-1}+b^{n-1}+c^{n-1} .
$$

Solution:
For fixed $n$ there are clearly finitely many solutions; we will show that there is no solution with $n>100$. So, assume $n>100$. By the AM-GM inequality,

$$
\begin{aligned}
n ! & =2 n(n-1)(n-2)(n-3) \cdot(3 \cdot 4 \cdots(n-4)) \\
& \leqslant 2(n-1)^{4}\left(\frac{3+\cdots+(n-4)}{n-6}\right)^{n-6}=2(n-1)^{4}\left(\frac{n-1}{2}\right)^{n-6}<\left(\frac{n-1}{2}\right)^{n-1}
\end{aligned}
$$

thus $a, b, c<(n-1) / 2$.

For every prime $p$ and integer $m \neq 0$, let $\nu_{p}(m)$ denote the $p$-adic valuation of $m$; that is, the greatest non-negative integer $k$ for which $p^{k}$ divides $m$. Legendre's formula states that

$$
\nu_{p}(n !)=\sum_{s=1}^{\infty}\left\lfloor\frac{n}{p^{s}}\right\rfloor
$$

and a well-know corollary of this formula is that

$$
\nu_{p}(n !)<\sum_{s=1}^{\infty} \frac{n}{p^{s}}=\frac{n}{p-1}
\tag{1}
$$

If $n$ is odd then $a^{n-1}, b^{n-1}, c^{n-1}$ are squares, and by considering them modulo 4 we conclude that $a, b$ and $c$ must be even. Hence, $2^{n-1} \mid n$ ! but that is impossible for odd $n$ because $\nu_{2}(n !)=\nu_{2}((n-1) !)<n-1$ by $(1)$.

From now on we assume that $n$ is even. If all three numbers $a+b, b+c, c+a$ are powers of 2 then $a, b, c$ have the same parity. If they all are odd, then $n !=a^{n-1}+b^{n-1}+c^{n-1}$ is also odd which is absurd. If all $a, b, c$ are divisible by 4 , this contradicts $\nu_{2}(n !) \leqslant n-1$. If, say, $a$ is not divisible by 4 , then $2 a=(a+b)+(a+c)-(b+c)$ is not divisible by 8 , and since all $a+b, b+c$, $c+a$ are powers of 2 , we get that one of these sums equals 4 , so two of the numbers of $a, b, c$ are equal to 2. Say, $a=b=2$, then $c=2^{r}-2$ and, since $c \mid n$ !, we must have $c \mid a^{n-1}+b^{n-1}=2^{n}$ implying $r=2$, and so $c=2$, which is impossible because $n ! \equiv 0 \not \equiv 3 \cdot 2^{n-1}(\bmod 5)$.

So now we assume that the sum of two numbers among $a, b, c$, say $a+b$, is not a power of 2 , so it is divisible by some odd prime $p$. Then $p \leqslant a+b<n$ and so $c^{n-1}=n !-\left(a^{n-1}+b^{n-1}\right)$ is divisible by $p$. If $p$ divides $a$ and $b$, we get $p^{n-1} \mid n$ !, contradicting (1)$. Next, using (1) and the Lifting the Exponent Lemma we get

$$
\nu_{p}(1)+\nu_{p}(2)+\cdots+\nu_{p}(n)=\nu_{p}(n !)=\nu_{p}\left(n !-c^{n-1}\right)=\nu_{p}\left(a^{n-1}+b^{n-1}\right)=\nu_{p}(a+b)+\nu_{p}(n-1)
\tag{2}
$$

In view of (2), no number of $1,2, \ldots, n$ can be divisible by $p$, except $a+b$ and $n-1>a+b$. On the other hand, $p \mid c$ implies that $p<n / 2$ and so there must be at least two such numbers. Hence, there are two multiples of $p$ among $1,2, \ldots, n$, namely $a+b=p$ and $n-1=2 p$. But this is another contradiction because $n-1$ is odd. This final contradiction shows that there is no solution of the equation for $n>100$.
Subfield: Combinatorics


Question: A rectangle $\mathcal{R}$ with odd integer side lengths is divided into small rectangles with integer side lengths. Prove that there is at least one among the small rectangles whose distances from the four sides of $\mathcal{R}$ are either all odd or all even.

Solution:
Let the width and height of $\mathcal{R}$ be odd numbers $a$ and $b$. Divide $\mathcal{R}$ into $a b$ unit squares and color them green and yellow in a checkered pattern. Since the side lengths of $a$ and $b$ are odd, the corner squares of $\mathcal{R}$ will all have the same color, say green.

Call a rectangle (either $\mathcal{R}$ or a small rectangle) green if its corners are all green; call it yellow if the corners are all yellow, and call it mixed if it has both green and yellow corners. In particular, $\mathcal{R}$ is a green rectangle.

We will use the following trivial observations.

- Every mixed rectangle contains the same number of green and yellow squares;
- Every green rectangle contains one more green square than yellow square;
- Every yellow rectangle contains one more yellow square than green square.

The rectangle $\mathcal{R}$ is green, so it contains more green unit squares than yellow unit squares. Therefore, among the small rectangles, at least one is green. Let $\mathcal{S}$ be such a small green rectangle, and let its distances from the sides of $\mathcal{R}$ be $x, y, u$ and $v$, as shown in the picture. The top-left corner of $\mathcal{R}$ and the top-left corner of $\mathcal{S}$ have the same color, which happen if and only if $x$ and $u$ have the same parity. Similarly, the other three green corners of $\mathcal{S}$ indicate that $x$ and $v$ have the same parity, $y$ and $u$ have the same parity, i.e. $x, y, u$ and $v$ are all odd or all even.

<img_3359>
Subfield: Geometry


Question: Let $A B C D E$ be a convex pentagon such that $A B=B C=C D, \angle E A B=\angle B C D$, and $\angle E D C=\angle C B A$. Prove that the perpendicular line from $E$ to $B C$ and the line segments $A C$ and $B D$ are concurrent.

Solution:
Throughout the solution, we refer to $\angle A, \angle B, \angle C, \angle D$, and $\angle E$ as internal angles of the pentagon $A B C D E$. Let the perpendicular bisectors of $A C$ and $B D$, which pass respectively through $B$ and $C$, meet at point $I$. Then $B D \perp C I$ and, similarly, $A C \perp B I$. Hence $A C$ and $B D$ meet at the orthocenter $H$ of the triangle $B I C$, and $I H \perp B C$. It remains to prove that $E$ lies on the line $I H$ or, equivalently, $E I \perp B C$.

Lines $I B$ and $I C$ bisect $\angle B$ and $\angle C$, respectively. Since $I A=I C, I B=I D$, and $A B=$ $B C=C D$, the triangles $I A B, I C B$ and $I C D$ are congruent. Hence $\angle I A B=\angle I C B=$ $\angle C / 2=\angle A / 2$, so the line $I A$ bisects $\angle A$. Similarly, the line $I D$ bisects $\angle D$. Finally, the line $I E$ bisects $\angle E$ because $I$ lies on all the other four internal bisectors of the angles of the pentagon.

The sum of the internal angles in a pentagon is $540^{\circ}$, so

$$
\angle E=540^{\circ}-2 \angle A+2 \angle B \text {. }
$$

In quadrilateral $A B I E$,

$$
\begin{aligned}
\angle B I E & =360^{\circ}-\angle E A B-\angle A B I-\angle A E I=360^{\circ}-\angle A-\frac{1}{2} \angle B-\frac{1}{2} \angle E \\
& =360^{\circ}-\angle A-\frac{1}{2} \angle B-\left(270^{\circ}-\angle A-\angle B\right) \\
& =90^{\circ}+\frac{1}{2} \angle B=90^{\circ}+\angle I B C,
\end{aligned}
$$

which means that $E I \perp B C$, completing the proof.

<img_3369>
We present another proof of the fact that $E$ lies on line $I H$. Since all five internal bisectors of $A B C D E$ meet at $I$, this pentagon has an inscribed circle with center $I$. Let this circle touch side $B C$ at $T$.

Applying Brianchon's theorem to the (degenerate) hexagon $A B T C D E$ we conclude that $A C, B D$ and $E T$ are concurrent, so point $E$ also lies on line $I H T$, completing the proof.
Subfield: Geometry


Question: Let $R$ and $S$ be distinct points on circle $\Omega$, and let $t$ denote the tangent line to $\Omega$ at $R$. Point $R^{\prime}$ is the reflection of $R$ with respect to $S$. A point $I$ is chosen on the smaller arc $R S$ of $\Omega$ so that the circumcircle $\Gamma$ of triangle $I S R^{\prime}$ intersects $t$ at two different points. Denote by $A$ the common point of $\Gamma$ and $t$ that is closest to $R$. Line $A I$ meets $\Omega$ again at $J$. Show that $J R^{\prime}$ is tangent to $\Gamma$.

Solution:
In the circles $\Omega$ and $\Gamma$ we have $\angle J R S=\angle J I S=\angle A R^{\prime} S$. On the other hand, since $R A$ is tangent to $\Omega$, we get $\angle S J R=\angle S R A$. So the triangles $A R R^{\prime}$ and $S J R$ are similar, and

$$
\frac{R^{\prime} R}{R J}=\frac{A R^{\prime}}{S R}=\frac{A R^{\prime}}{S R^{\prime}}
$$

The last relation, together with $\angle A R^{\prime} S=\angle J R R^{\prime}$, yields $\triangle A S R^{\prime} \sim \triangle R^{\prime} J R$, hence $\angle S A R^{\prime}=\angle R R^{\prime} J$. It follows that $J R^{\prime}$ is tangent to $\Gamma$ at $R^{\prime}$.

<img_3781>
<img_3184>

We notice that $\angle J R S=\angle J I S=\angle A R^{\prime} S$, so we have $R J \| A R^{\prime}$.

Let $A^{\prime}$ be the reflection of $A$ about $S$; then $A R A^{\prime} R^{\prime}$ is a parallelogram with center $S$, and hence the point $J$ lies on the line $R A^{\prime}$.

From $\angle S R^{\prime} A^{\prime}=\angle S R A=\angle S J R$ we get that the points $S, J, A^{\prime}, R^{\prime}$ are concyclic. This proves that $\angle S R^{\prime} J=\angle S A^{\prime} J=\angle S A^{\prime} R=\angle S A R^{\prime}$, so $J R^{\prime}$ is tangent to $\Gamma$ at $R^{\prime}$.
Subfield: Geometry


Question: Let $O$ be the circumcenter of an acute scalene triangle $A B C$. Line $O A$ intersects the altitudes of $A B C$ through $B$ and $C$ at $P$ and $Q$, respectively. The altitudes meet at $H$. Prove that the circumcenter of triangle $P Q H$ lies on a median of triangle $A B C$.

Solution:
Suppose, without loss of generality, that $A B<A C$. We have $\angle P Q H=90^{\circ}-$ $\angle Q A B=90^{\circ}-\angle O A B=\frac{1}{2} \angle A O B=\angle A C B$, and similarly $\angle Q P H=\angle A B C$. Thus triangles $A B C$ and $H P Q$ are similar. Let $\Omega$ and $\omega$ be the circumcircles of $A B C$ and $H P Q$, respectively. Since $\angle A H P=90^{\circ}-\angle H A C=\angle A C B=\angle H Q P$, line $A H$ is tangent to $\omega$.

<img_3878>

Let $T$ be the center of $\omega$ and let lines $A T$ and $B C$ meet at $M$. We will take advantage of the similarity between $A B C$ and $H P Q$ and the fact that $A H$ is tangent to $\omega$ at $H$, with $A$ on line $P Q$. Consider the corresponding tangent $A S$ to $\Omega$, with $S \in B C$. Then $S$ and $A$ correspond to each other in $\triangle A B C \sim \triangle H P Q$, and therefore $\angle O S M=\angle O A T=\angle O A M$. Hence quadrilateral $S A O M$ is cyclic, and since the tangent line $A S$ is perpendicular to $A O$, $\angle O M S=180^{\circ}-\angle O A S=90^{\circ}$. This means that $M$ is the orthogonal projection of $O$ onto $B C$, which is its midpoint. So $T$ lies on median $A M$ of triangle $A B C$.
Subfield: Number Theory


Question: Determine all integers $n \geqslant 2$ with the following property: for any integers $a_{1}, a_{2}, \ldots, a_{n}$ whose sum is not divisible by $n$, there exists an index $1 \leqslant i \leqslant n$ such that none of the numbers

$$
a_{i}, a_{i}+a_{i+1}, \ldots, a_{i}+a_{i+1}+\cdots+a_{i+n-1}
$$

is divisible by $n$. (We let $a_{i}=a_{i-n}$ when $i>n$.)

Solution:
Let us first show that, if $n=a b$, with $a, b \geqslant 2$ integers, then the property in the statement of the problem does not hold. Indeed, in this case, let $a_{k}=a$ for $1 \leqslant k \leqslant n-1$ and $a_{n}=0$. The sum $a_{1}+a_{2}+\cdots+a_{n}=a \cdot(n-1)$ is not divisible by $n$. Let $i$ with $1 \leqslant i \leqslant n$ be an arbitrary index. Taking $j=b$ if $1 \leqslant i \leqslant n-b$, and $j=b+1$ if $n-b<i \leqslant n$, we have

$$
a_{i}+a_{i+1}+\cdots+a_{i+j-1}=a \cdot b=n \equiv 0 \quad(\bmod n)
$$

It follows that the given example is indeed a counterexample to the property of the statement.

Now let $n$ be a prime number. Suppose by contradiction that the property in the statement of the problem does not hold. Then there are integers $a_{1}, a_{2}, \ldots, a_{n}$ whose sum is not divisible by $n$ such that for each $i, 1 \leqslant i \leqslant n$, there is $j, 1 \leqslant j \leqslant n$, for which the number $a_{i}+a_{i+1}+$ $\cdots+a_{i+j-1}$ is divisible by $n$. Notice that, in any such case, we should have $1 \leqslant j \leqslant n-1$, since $a_{1}+a_{2}+\cdots+a_{n}$ is not divisible by $n$. So we may construct recursively a finite sequence of integers $0=i_{0}<i_{1}<i_{2}<\cdots<i_{n}$ with $i_{s+1}-i_{s} \leqslant n-1$ for $0 \leqslant s \leqslant n-1$ such that, for $0 \leqslant s \leqslant n-1$,

$$
a_{i_{s}+1}+a_{i_{s}+2}+\cdots+a_{i_{s+1}} \equiv 0 \quad(\bmod n)
$$

(where we take indices modulo $n$ ). Indeed, for $0 \leqslant s<n$, we apply the previous observation to $i=i_{s}+1$ in order to define $i_{s+1}=i_{s}+j$.

In the sequence of $n+1$ indices $i_{0}, i_{1}, i_{2}, \ldots, i_{n}$, by the pigeonhole principle, we have two distinct elements which are congruent modulo $n$. So there are indices $r, s$ with $0 \leqslant r<s \leqslant n$ such that $i_{s} \equiv i_{r}(\bmod n)$ and

$$
a_{i_{r}+1}+a_{i_{r}+2}+\cdots+a_{i_{s}}=\sum_{j=r}^{s-1}\left(a_{i_{j}+1}+a_{i_{j}+2}+\cdots+a_{i_{j+1}}\right) \equiv 0 \quad(\bmod n)
$$

Since $i_{s} \equiv i_{r}(\bmod n)$, we have $i_{s}-i_{r}=k \cdot n$ for some positive integer $k$, and, since $i_{j+1}-i_{j} \leqslant$ $n-1$ for $0 \leqslant j \leqslant n-1$, we have $i_{s}-i_{r} \leqslant(n-1) \cdot n$, so $k \leqslant n-1$. But in this case

$$
a_{i_{r}+1}+a_{i_{r}+2}+\cdots+a_{i_{s}}=k \cdot\left(a_{1}+a_{2}+\cdots+a_{n}\right)
$$

cannot be a multiple of $n$, since $n$ is prime and neither $k$ nor $a_{1}+a_{2}+\cdots+a_{n}$ is a multiple of $n$. A contradiction.

Final answer: all the prime numbers