## Task 2.

A frog is located at the origin $O$ of a number line and needs to perform 2022 jumps, each of a different length from $1, 2, \ldots, 2022$. The jumps must be performed in such an order that the following rules are respected:

- if the frog is currently at point $O$ or to the left of it, it must jump to the right,
- if the frog is to the right of point $O$, it must jump to the left.

Determine the largest natural number $k$ for which the frog can jump in such a way that it never lands on any of the numbers $1, 2, \ldots, k$.
## Solution.

Let $n=$ 2022. Suppose there is a sequence of $n$ jumps of lengths $1,2, \ldots, n$ in some order such that the frog never lands on any of the numbers $1,2, \ldots, k$ for $k \geqslant 1$. Note that if the frog is on a number $a \geqslant k+1$, it actually stands on a number $a \geqslant k+1$ since it cannot be on any of the numbers $1,2, \ldots, k$. This means the frog can only jump left if it is on a number $a \geqslant k+1$, so it cannot reach a number less than $k+1-n$. Therefore, the frog can only land on numbers $i$ that satisfy

$$
k+1-n \leqslant i \leqslant 0 \quad \text { or } \quad k+1 \leqslant i \leqslant n
$$

Consider what happens at the moment the frog makes a jump of length exactly $k$. After this jump, it must remain on the same side of the numbers $1,2, \ldots, k$ because a jump of length at least $k+1$ is required to jump over all these numbers.

If this jump is made from a position $a>0$, it will end up at the number $a-k$, so it must be true that $a-k \geqslant k+1$ or $2 k+1 \leqslant a \leqslant n$. Thus, we have $2 k+1 \leqslant n$ in this case.

If this jump is made from a position $a \leqslant 0$, then $k+1-n \leqslant a \leqslant 0$. It will then end up at the number $a+k$, so it must be true that $a+k \leqslant 0$ and $2 k+1-n \leqslant a+k \leqslant 0$. Again, we conclude $2 k+1 \leqslant n$.

Thus, we have shown that $k \leqslant \frac{n-1}{2}=1010.5$. Since $k$ is an integer, we have $k \leqslant 1010$.

Now we show that it is possible to make a sequence of jumps such that the frog never lands on any of the numbers $1,2, \ldots, k$ for $k=1010$. First, make a jump of length $k+1$.

Then we make jumps in pairs. First, make a pair of jumps of lengths $k+2$ and 1, then a pair of jumps of lengths $k+3$ and 2. We continue making pairs of jumps: first of length $k+i+1$, and then $i$, for $i=4, \ldots, k$. Finally, make a jump of length $n=2 k+2=2022$. Note that we have made jumps of all possible lengths $1,2, \ldots, n$ exactly once.

We show that this sequence of jumps never lands on any of the numbers $1,2, \ldots, k$ for $k=1010$. After the first jump, the frog lands on the number $k+1>k$. Suppose the frog is at number 0 or $k+1$ and is about to make a pair of jumps of lengths first $k+i+1$, and then $i$. If it is at number 0, the first jump takes it to the number $k+i+1>k$, and the second to the number $k+i+1-i=k+1>k$. If it is at number $k+1$, the first jump takes it to the number $k+1-(k+i+1)=-i<0$, and the second to the number $k+1-(2 k+2)=-k-1<1$. Thus, it never lands on any of the numbers $1,2, \ldots, k$, so $k=1010$ is the desired answer.