The night watchman wrote down a sequence of numbers to pass the time. He started with a certain natural number. Each subsequent member of the sequence was created by adding a certain number to the previous one: to the first member, he added 1, to the second 3, to the third 5, to the fourth 1, to the fifth 3, to the sixth 5, to the seventh 1, and so on. We know that the numbers 40 and 874 appear in his sequence.

1. Which number follows immediately after 40 in the sequence and which one immediately after 874?
2. In the sequence, we find two consecutive members whose sum is 491. Which two numbers are these?

## (L. Šimunek)
1. The guard proceeded from the number 40 by adding $+1+3+5$ or $+3+5+1$ or $+5+1+3$. In any case, he reached the number 49. He must have also reached the numbers 58, 67, etc., i.e., generally $40+a \cdot 9$, where $a$ is a natural number. The highest such number less than 874 is $868=40+92 \cdot 9$. For the guard to get the number 874, he could only add $+5+1$ to 868. From this, we can deduce the order of the addends that the guard added between the numbers 859 and 868, and similarly between the numbers 40 and 49. This order is $+5+1+3$. It is now clear that the number following 40 in the sequence is 45, and the number following 874 is 877.

2. The difference between two consecutive numbers in the sequence can be 1, 3, or 5. Therefore, the sought numbers can be a) 245 and 246, b) 244 and 247, or c) 243 and 248. We need to find a term in the sequence whose value is close to the sought numbers. One such number is 238, because $238=40+22 \cdot 9$. From the previous part of the problem, we know that after such a number, the addition $+5+1+3$ follows. Therefore, the part of the sequence consists of the numbers ..., 238, 243, 244, 247, 252, ... and the sought terms in the sequence are 244 and 247.

Alternative solution to part 2. First, we determine whether the pair of numbers a) 245 and 246 belongs to the sequence. From the difference between these numbers, we deduce that the number 245 must have been obtained by adding +5, so the previous term would be 240. The term 240 would be preceded by the triplet of addends $+5+1+3$, i.e., the one that follows the term 40. However, this is not possible because $240-40=200$ and 200 is not a multiple of nine. Similarly, we can investigate the remaining pairs b) and c).

Evaluation. In part 1, 2 points for the correct answer and 2 points for the justification; in part 2, 1 point for the correct answer and 1 point for the justification.