5. Replace each of the stars in the twelve-digit numbers $A=* 88888888888, B=$ $=* 11111111111$ with some digit so that the expression $|14 A-13 B|$ has the smallest possible value.
SOLUTION. We will replace the asterisk in the number $A$ with the digit $a$, the asterisk in the number $B$ with the digit $b$, and express the expression $14A-13B$ algebraically as a linear function of the (unknown) digits $a$ and $b$. Since

$$
11111111111111=\frac{99999999999999}{9}=\frac{10^{11}-1}{9},
$$

the numbers $A$ and $B$ have the representations

$$
A=a \cdot 10^{11}+\frac{8}{9} \cdot\left(10^{11}-1\right) \quad \text { and } \quad B=b \cdot 10^{11}+\frac{1}{9} \cdot\left(10^{11}-1\right) \text {, }
$$

from which we get

$$
\begin{aligned}
14 A-13 B & =(14 a-13 b) \cdot 10^{11}+\frac{(14 \cdot 8-13)}{9} \cdot\left(10^{11}-1\right)= \\
& =(14 a-13 b+11) \cdot 10^{11}-11
\end{aligned}
$$

We will certainly realize that the absolute value of such an expression is minimal precisely when the absolute value of the expression $14 a-13 b+11$ is minimal. We will justify this with inequalities only after we determine whether for some digits $a, b$ the equality $14 a-13 b+11=0$ holds. If we express the unknown $b$ from such an equation,

$$
b=\frac{14 a+11}{13}=a+1+\frac{a-2}{13},
$$

and notice that for any digit $a$ we have $-2 \leqq a-2 \leqq 7$, we see that the value of $b$ given by the last formula is an integer only in the case $a-2=0$, when $a=2$ and $b=3$. Only for such digits $a, b$ does the equality $14 a-13 b+11=0$ hold, so according to $(*)$ we have $|14 A-13 B|=11$. For any other pair of digits $a, b$, however, the inequality $14 a-13 b+11 \neq 0$ holds, so in this case according to $(*)$ we conclude that

$$
\begin{aligned}
& \text { either } \quad 14 a-13 b+11 \geqq 1, \quad \text { and thus } \quad 14 A-13 B \geqq 10^{11}-11>11 \text {, } \\
& \text { or } \quad 14 a-13 b+11 \leqq-1, \quad \text { and thus } \quad 14 A-13 B \leqq-10^{11}-11.
\end{aligned}
$$

Answer: The expression $|14 A-13 B|$ has the smallest possible value only when the asterisks in the numbers $A, B$ are replaced by the digits 2 and 3, respectively.

## GUIDING AND SUPPLEMENTARY PROBLEMS: