4. Determine the largest number divisible by 11 and whose digits are all different.
Solution. We will prove that there exist ten-digit numbers of the form $\overline{98765 a b c d e}$ where ( $a, b, c, d, e$ ) is some permutation of the set $\{0,1,2,3,4\}$, which are divisible by 11, and among them, we will determine the largest number. This number will obviously be the largest ten-digit number written with different digits that is divisible by 11.

For a number of the given form to be divisible by 11, it is necessary and sufficient that the number

$$
\begin{aligned}
A & =9+7+5+b+d-(8+6+a+c+e) \\
& =7+b+d-(10-(b+d))=2(b+d)-3
\end{aligned}
$$

is divisible by 11. From the condition on $b$ and $d$, it follows that $1 \leq b+d \leq 7$, or that $-1 \leq A \leq 11$. Since A is odd, the only possibility for it to be divisible by 11 is $A=11$, which means $b+d=7$. According to this, $(b, d)$ is some permutation of the set $\{3,4\}$, and ( $a, c, e$ ) is some permutation of the set $\{0,1,2\}$. The largest number of the described form that satisfies these conditions is 9876524130.

## III year