2. 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 it is possible to obtain the sequence

a) 11, 15, 16, 18, 19, 21, 22,

b) 11, 15, 16, 18, 19, 21, 23.

(Patrik Bak)
SOLUTION. a) Yes, for example, the number 137658942 satisfies the condition. The sums of its consecutive triplets of digits from left to right are 11, 16, 18, 19, 22, 21, 15.

b) We will show that for any nine-digit number $\overline{a_{1} a_{2} \ldots a_{8} a_{9}}$ composed of the digits 1 to 9, the sum of the seven numbers determined by the problem is at most 122. Since for the numbers in part b) we have $11+15+16+18+19+21+23=123$, we will show that the required nine-digit number does not exist.

The sum $S$ of the seven numbers can be written and estimated as follows:

\[
\begin{aligned}
S & =\left(a_{1}+a_{2}+a_{3}\right)+\left(a_{2}+a_{3}+a_{4}\right)+\ldots+\left(a_{6}+a_{7}+a_{8}\right)+\left(a_{7}+a_{8}+a_{9}\right)= \\
& =a_{1}+2 a_{2}+3 a_{3}+3 a_{4}+3 a_{5}+3 a_{6}+3 a_{7}+2 a_{8}+a_{9}= \\
& =3(\underbrace{a_{1}+a_{2}+\ldots+a_{8}+a_{9}}_{=1+2+\ldots+9=45})-(\underbrace{a_{1}+a_{2}+a_{8}+a_{9}}_{\geqq 1+2+3+4=10})-(\underbrace{a_{1}+a_{9}}_{\geqq 1+2=3}) \leqq \\
& \leqq 3 \cdot 45-10-3=122 .
\end{aligned}
\]

This proves the statement in the first sentence of our solution to part b).

COMMENT. Although the above solution is complete, we will now show how to find an example of a number that satisfies the condition in part a). We will even find all such numbers, based on the observation that led us to the solution of part b).

The first good step is to notice that both sets of seven numbers in the problem contain "relatively large" numbers for all the digits 1 to 9 to be represented. This can motivate us to assess the overall sum $S$ of all seven given numbers. How large can this sum be? The answer to this question certainly depends on how many times each digit is represented in the sum $S$. It is then quite easy to come up with an upper bound for $S$ of 122, as we did above.

Let us now add what we did not need in the solution to part b). From our derivation, it follows that the equality $S=122$ holds if and only if the number $\overline{a_{1} \ldots a_{9}}$ satisfies the equalities

\[
\left\{a_{1}, a_{2}, a_{8}, a_{9}\right\}=\{1,2,3,4\} \quad \text { and } \quad\left\{a_{1}, a_{9}\right\}=\{1,2\}
\]

or $\left\{a_{1}, a_{9}\right\}=\{1,2\}$ and $\left\{a_{2}, a_{8}\right\}=\{3,4\} .^{*}$

Since the sum $11+15+16+18+19+21+22$ of the numbers given in part a) is exactly the assessed value of 122, the sought numbers $\overline{a_{1} a_{2} \ldots a_{8} a_{9}}$ with digits 1 to 9 are precisely those for which $\left\{a_{1}, a_{9}\right\}=\{1,2\}$ and $\left\{a_{2}, a_{8}\right\}=\{3,4\}$. According to the possible positions of the digits 1, 2, 3, 4, only 4 types of numbers are possible.

Let us first examine the numbers $\overline{13 a_{3} \ldots a_{7} 42}$. For $1+3+a_{3}$ to be one of the prescribed sums, $a_{3}$ must be 7; similarly, for the sum $a_{7}+4+2$, $a_{7}$ must be 9. We thus have the numbers $\overline{137 a_{4} a_{5} a_{6} 942}$. It remains to assess the six ways to assign the triplet $a_{4}, a_{5}$, and $a_{6}$ the remaining[^1]digits 5, 6, and 8. Each individual way is easy to test, and it is advantageous to be able to rule out some of them in advance (for example, by noting that $a_{4} \neq 5$). Without going into these details, we can state that in the end, we get exactly two numbers that satisfy the condition: 137658942 and 137685942.

Examining the numbers $\overline{14 a_{3} \ldots a_{7} 32}$ is shorter: This time, we find that both digits $a_{3}$ and $a_{7}$ would have to be 6, so no number of this type satisfies the condition.

It is not necessary to examine the remaining numbers $\overline{23 a_{3} \ldots a_{7} 41}$ and $\overline{24 a_{3} \ldots a_{7} 31}$. It is sufficient to convert them to the previous two types, thanks to the general observation: a number $\overline{a_{1} a_{2} \ldots a_{8} a_{9}}$ satisfies the condition if and only if its "reversed" number $\overline{a_{9} a_{8} \ldots a_{2} a_{1}}$ satisfies the condition.

To summarize what we have found: The numbers that satisfy the condition in part a) are exactly four. They are the numbers 137658942, 137685942, and their "mirror images" 249856731 and 249586731.

## GUIDING AND SUPPLEMENTARY PROBLEMS:

N1. Find the five-digit numbers, each of which has five different odd digits, such that the sum of the first three digits is 11 and the sum of the last three digits is 15. [The middle digit must be 1, because $11+15$ is one more than $1+3+5+7+9$. The first two digits must be 3 and 7, and the last two must be 9 and 5. All such numbers satisfy the condition: 37159, 37195, 73159, 73195.]

N2. Determine the largest possible values of the following sums, where $a_{1}, a_{2}, \ldots, a_{8}, a_{9}$ is any permutation of the digits $1,2, \ldots, 8,9$:
a) $a_{1}