Problem 8.6. 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. Mark 10 points on the plane, representing the digits from 0 to 9, and connect those that sum to the square of a natural number.

![](https://cdn.mathpix.com/cropped/2024_05_06_d4986512fdb0330805a0g-26.jpg?height=402&width=398&top_left_y=1071&top_left_x=528)

On such a 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.