8.5. A natural number is called interesting if all its digits are different, and the sum of any two adjacent digits is a square of a natural number. Find the largest interesting number.
Answer: 6310972.

Solution. Let's mark 10 points on the plane, representing the digits from 0 to 9, and connect those points whose sum is a square of a natural number.

![](https://cdn.mathpix.com/cropped/2024_05_06_01eaca71e034b8dd1883g-2.jpg?height=343&width=368&top_left_y=2364&top_left_x=798)

On this diagram, we need to find the path of maximum length, as the largest number should have the maximum number of digits. It is easy to notice that this path is $2-7-9-0-1-3-6$. To make the number as large as possible, the first digit should be as large as possible, i.e., the answer is the number 6310972.

Internet resources: http://www.problems.ru, https://olimpiada.ru.