Current location - Training Enrollment Network - Mathematics courses - How to skillfully solve the nine-ring chain
How to skillfully solve the nine-ring chain
Since only one ring is moved at a time, the representations of the two steps differ by only one number. Let's take the five rings as an example. The five digits in the first column from the left are in the five-ring state, arranged from the first ring to the fifth ring in turn. The second column is a five-digit number representing the reverse order, which looks like a binary number, but compared with the fourth column, it can be seen that this is not the number of steps represented by a binary number. The third column is the number of steps from the initial state to this state. The rightmost column is the binary representation of the step.

00000-00000-0-00000

10000-0000 1- 1-0000 1

………………………………

0 1 1 1 1- 1 1 1 10-20- 10 100

1 1 1 1 1- 1 1 1 1 1-2 1- 10 10 1

We found that the number in the right column is the gray code of binary number from decimal number 0 to 2 1! This of course requires 2 1 step. If you write 5-digit binary numbers in turn, it is

10 1 1 1- 1 1 10 1-22- 10 1 10

………………………………

0000 1- 10000-3 1- 1 1 1 1 1

For a five-ring chain with only five rings, the state from the initial state to111is not used most, and the state to 000 1 is used most, with 3 1 step. Similarly, for the nine-ring chain, it is not used most from the initial state11111,but in the state 0000000/kloc. Gray code111111stands for binary number 1065438+. This is the mathematical connotation of the nine chains.

Note: from binary number to gray code: check from right to left. If the left side of a number is 0, the number remains unchanged; If it is 1, the number changes (0 becomes 1, 1 becomes 0). For example, the gray code of binary number111is10.

Gray code to binary number: check from right to left, if the sum of the left digits of a number is even, the number remains unchanged; If it is odd, the number will change.

For example, the Gray code1101indicates that the binary number is 100 10.

The above can be used to help memory: 2G becomes zero and G2 becomes parity.

For example, suppose that the initial state of nine chains is1110, and the required termination state is 0010165438. How many steps does a simple solution and a complete solution take? How was the process?

The initial state is110110, and the gray code is 011/kloc-0. The termination status is 00 10011,the gray code is1110065438, and the converted binary number is100. The difference between them is 326-141= 186, and the complete solution needs186 steps.

For simple steps, we find the corresponding simple steps from 14 1 327 respectively. For N= 14 1, we get n0 =103; For N=327, N0=242. The difference between them is 139, so the simple step is 139. This result is easy to verify on the next page of the nine-ring computer game.

In fact, the solution of nine chains only needs to follow the "parity" law. Here's an explanation:

When solving a nine-ring chain, you must first know which ring you want to solve first, and then solve it. If you want to solve the seven rings, first solve the first ring (if you can't even solve the first ring, I advise you to give up), then solve the third ring, then solve the second ring, the fifth ring and the fourth ring, finally solve the seventh ring, and then retreat the six rings (remember to add one ring to the retreat); If you want to untie the fourth ring, you can retreat the first ring, the second ring, and then the fourth ring, and so on.