Yatsenko I.V.

Vanya is coming up with a number consisting of non-repeating digits without zeros - a password for his phone. The password works as follows: if, without lifting his finger from the screen, he sequentially connects the points corresponding to the digits of the password with lines, the phone will unlock. However, the phone does not allow connecting two points with a line if there is a third point between them: if Vanya connects, for example, 1 and 3, the phone will "think" that Vanya is entering 1-2-3.

Vanya wants the line traced by his finger not to intersect itself. Additionally, he wants it so that by rearranging the digits of the password, no other such line can be obtained, except in reverse order. For example, the password 1263 is not to Vanya's liking because the line 6-3-2-1 is different but also does not have self-intersections. Vanya came up with the password 723 (see the image). These three digits - 2, 3, and 7 - indeed cannot be connected in any other way. It's a pity, though, that the password is so short.

Help Vanya come up with a longer password. In your answer, write the password and draw the only line that can be formed from these digits.

![](https://cdn.mathpix.com/cropped/2024_05_06_39c3940b0a0b7bafc849g-39.jpg?height=486&width=432&top_left_y=1858&top_left_x=813)

#
The password 12769 meets Vanya's requirements. Let's see how we can connect its digits without any intersections. The digit 7 must be connected to either 2 or 6. Suppose we draw the segment 7-6. Now, 9 can only be connected to 6. Next, we inevitably need to draw the segments 7-2 and 2-1, and we get the line shown in the figure. If we had drawn 7-2 instead of 7-6 first, the line would have been the same. Thus, this line is unique.

Comment. Interestingly, it is impossible to come up with a four-digit password that satisfies Vanya's requirements. There is also no password with six or more digits. There are eight possible five-digit passwords: 12769, 96721, 14389, 98341, 32947, 74923, 78163, 36187. However, the lines for all eight passwords are of the same form, differing only in rotation, symmetry, or the direction of drawing.

## Answer

For example, 12769. See the figure.

![](https://cdn.mathpix.com/cropped/2024_05_06_39c3940b0a0b7bafc849g-40.jpg?height=298&width=283&top_left_y=134&top_left_x=888)

Submit a comment