1. Using the digits 1 to 9, we form a nine-digit number with distinct digits. Then we calculate the sum of each triplet of adjacent digits and write down these seven sums in ascending order. Determine whether we can obtain the sequence

a) 9, 11, 12, 13, 20, 20, 20,
b) 9, 11, 12, 13, 20, 21, 21.

(Martin Melicher)
SOLUTION. a) We will prove by contradiction that it is impossible to obtain any sequence that contains the number 20 three times, and thus not even the one from the problem statement.

Assume, on the contrary, that for some number $\overline{a_{1} a_{2} \ldots a_{9}}$ with mutually distinct digits, there exist three indices $1 \leqq i<j<k \leqq 7$ such that

$$
a_{i}+a_{i+1}+a_{i+2}=a_{j}+a_{j+1}+a_{j+2}=a_{k}+a_{k+1}+a_{k+2}=20.
$$

Since the sum of six different digits is at most $9+8+7+6+5+4=39<2 \cdot 20$, the extreme triplets of addends $\left(a_{i}, a_{i+1}, a_{i+2}\right)$ and $\left(a_{k}, a_{k+1}, a_{k+2}\right)$ must "overlap." Therefore, $k \leqq i+2$, which, considering $i<j<k$, means that $k=i+2$, and thus $j=i+1$. The first equality in (1) then becomes $a_{i}+a_{i+1}+a_{i+2}=a_{i+1}+a_{i+2}+a_{i+3}$, from which $a_{i}=a_{i+3}$, which is a contradiction. This completes the promised proof.

b) Yes, for example, the number 849751623 satisfies the condition. The sums of its consecutive triplets of digits are (from left to right) 21, 20, 21, 13, 12, 9, 11.

Comment. Although the provided solution is complete, we will explain how to find an example of a number that satisfies part b). We will even show that, besides the given number 849751623, only its "mirror" copy 326157948 satisfies the condition.

From considerations similar to those in part a) of our solution, it follows that the required sums equal to the number 21 cannot be given by either two disjoint triplets of digits or two triplets with two common digits - let's call such triplets neighboring triplets. Two triplets with a sum of 21, therefore, must have one common digit, so both are adjacent to the same triplet with a smaller sum.

For any two neighboring triplets of digits, their sums differ by the difference of the two digits that lie only in one of the two triplets. Since such a difference is at most $9-1=8$ and since the sums different from 21 are 9, 11, 12, 13, and 20, a triplet with a sum of 21 can only be adjacent to triplets with a sum of 13 or 20. This can only happen if one of the triplets with a sum of 21 is "at the edge," i.e., is adjacent to only one triplet.

Let's examine in detail the situation where one of the triplets with a sum of 21 is the first from the left. According to our considerations, for the sought number $\overline{a_{1} a_{2} \ldots a_{9}}$, one of the following cases will occur:

(i) $a_{1}+a_{2}+a_{3}=21, a_{2}+a_{3}+a_{4}=13, a_{3}+a_{4}+a_{5}=21, a_{4}+a_{5}+a_{6}=20$,

(ii) $a_{1}+a_{2}+a_{3}=21, a_{2}+a_{3}+a_{4}=20, a_{3}+a_{4}+a_{5}=21, a_{4}+a_{5}+a_{6}=13$.

We can easily rule out case (i), as then $a_{1}-a_{4}=8$, so $a_{4}=1$, and from the equality $a_{3}+a_{4}+a_{5}=21$ it follows that $a_{3}+a_{5}=20$, which is an obvious contradiction.

In case (ii), we have $a_{3}-a_{6}=8$, or $a_{3}=9$ and $a_{6}=1$, so the given equalities can be simplified after substitution to

$$
a_{1}+a_{2}=a_{4}+a_{5}=12 \quad \text{and} \quad a_{2}+a_{4}=11
$$

Since the digit 9 does not appear here, from the two sums equal to 12 it follows that $\left\{a_{1}, a_{2}\right\}$ and $\left\{a_{4}, a_{5}\right\}$ are in some order the sets $\{4,8\}$ and $\{5,7\}$. The equality $a_{2}+a_{4}=11$ then leads to the conclusion that $\left\{a_{2}, a_{4}\right\}=\{4,7\}$. The first 6 digits of the sought nine-digit number are thus either 849751 or 579481. Now we will start to complete these two beginnings from the right with the digits 2, 3, 6 in a suitable order so that we get new triplets of consecutive digits with the still missing sums 9, 11, and 12. We will find the only suitable number 849751623 (uncompleted completions lead to 849751 3??, 579481 26?, and 579481 3??).

The second situation, where the triplet with a sum of 21 is the first from the right, does not need to be examined. From such a suitable number $\overline{a_{1} a_{2} \ldots a_{9}}$ we can transition to the suitable number $\overline{a_{9} a_{8} \ldots a_{1}}$, which, according to the previous analysis, is equal to 849751623. The second situation thus corresponds to the only suitable number 326157948.