What is a Rubik's Cube? If the picture on the right is a Rubik's cube, that is, n× n (n >; =3) Put the numbers into an n×n grid so that the numbers in each row, column and diagonal of the grid are equal.
8 1 6
3 5 7
4 9 2
When n is odd, we call the magic square an odd magic square. It can be realized by Merzirac method and loubere method, so it is named horse method. Imagine the Rubik's Cube as a nine-palace with two protruding ends, arrange the numbers obliquely from left to right (nine-child oblique arrangement), switch the numbers up and down from left to right in turn (up and down, left to right), and "pull out" the numbers on the upper left, lower left, upper right and lower right (four-dimensional protrusion).
4 9 2
3 5 7
8 1 6 Put 1 in the box in the middle of the first row, and fill in 2, 3, 4 in the upper left corner in turn ... If there are numbers in the upper left corner, move down one box to continue filling in. The fifth-order magic square generated by Merziral method is as follows:
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 2 1 3
1 1 18 25 2 9 Put 1 in the middle box, and fill in 2, 3, 4 in the upper left corner in turn ... If there are numbers in the upper left corner, move up two boxes to continue filling in. The seventh-order magic square generated by Louberel method is as follows:
30 39 48 1 10 19 28
38 47 7 9 18 27 29
46 6 8 17 26 35 37
5 14 16 25 34 36 45
13 15 24 33 42 44 4
2 1 23 32 4 1 43 3 12
22 3 1 40 49 21120 Put1in any box first. Go left 1 step, go down two steps to put 2 (called "horse stance just look"), go left 1 step, go down two steps to put 3, and so on. Put n+ 1 (called skip) under n, then put it under 2n according to the above method, and put 2n+ 1 under 2n. The fifth-order magic square generated by Ma method is as follows:
77 58 39 20 1 72 53 34 15
6 68 49 30 1 1 73 63 44 25
16 78 59 40 2 1 2 64 54 35
26 7 69 50 3 1 12 74 55 45
36 17 79 60 4 1 22 3 65 46
37 27 8 70 5 1 32 13 75 56
47 28 18 80 6 1 42 23 4 66
57 38 19 9 7 1 52 33 14 76
67 48 29 10 8 1 62 43 24 5
Generally let the matrix take a step to the left. The horse stance just look can be expressed as 2X+Y, {x ∈ {,}, y ∈ {[0, 1], [0, 1]} {y ∈ {,}, and the corresponding jump of X∈{[2X+Y can The above is an x jump. The Rubik's Cube generated by Mafa is the Devil's Cube. Consider the magic square of order n as a matrix, and write it as a, and the numbers in the grid of row I and column J are written as a(i, j). Fill in 1, 2,3, ..., n on the two diagonal lines of A, and then fill in 1, 2,3, ..., n, so that the sum of the numbers in each row and column is n*(n+ 1)/2. The filling method is: line 1 is filled from n to 1, and line 2 to n/2 is filled from 1 (line 2, line 1, line 2, column n 1), and line 2, line n/2+/kloc. The following is the sixth-order filling method:
1 5 4 3 2 6
6 2 3 4 5 1
1 2 3 4 5 6
6 5 3 4 2 1
6 2 4 3 5 1
1 5 4 3 2 6
The following is the eighth-order filling method (after transposition):
1 8 1 1 8 8 8 1
7 2 2 2 7 7 2 7
6 3 3 3 6 3 6 6
5 4 4 4 4 5 5 5
4 5 5 5 5 4 4 4
3 6 6 6 3 6 3 3
2 7 7 7 2 2 7 2
8 1 8 8 1 1 1 8
Calculate all the numbers on a according to the following algorithm to get b, where b (i, j) = n× (a (i, j)- 1). Then AT+B is the target Rubik's cube.
(AT is a transposed matrix). The magic square of order 8 generated by the lease method is as follows:
1 63 6 5 60 59 58 8
56 10 1 1 12 53 54 15 49
4 1 18 19 20 45 22 47 48
33 26 27 28 29 38 39 40
32 39 38 36 37 27 26 25
24 47 43 45 20 46 18 17
16 50 54 53 12 1 1 55 9
57 7 62 6 1 4 3 2 64N even magic square is expressed as 4m+2 magic square. Divide into four parts and become four magic squares of 2m+ 1 order as shown in the figure below.
A c
D B
A from 1 to 2m+ 1 to fill (2m+ 1) the second-order magic square; B fill the magic square of order 2m+ 1 with (2m+ 1) 2 to 2*(2m+ 1)2; C Fill the magic square of order 2m+ 1 with 2 * (2m+ 1) 2 to 3*(2m+ 1)2; D fill the magic square of order 2m+ 1 with 3 * (2m+ 1) 2 to 4*(2m+ 1)2; Take the m cells in the middle row of A, and the m- 1 column on the left edge of other rows, and exchange them with the cells corresponding to D; The m- 1 column near the right side of b and c is interchanged. The sixth-order magic square generated by Strachey method is as follows:
35 1 6 26 19 24
3 32 7 2 1 23 25
3 1 9 2 22 27 20
8 28 33 17 10 15
30 5 34 12 14 16
4 36 29131811The n-order dichotomy magic square is represented as a magic square of order 4m. Consider the magic square of order n as a matrix, and write it as a, and the numbers in the grid of row I and column J are written as a(i, j).
Shilling a(i, j)=(i- 1)*n+j, that is, the first line can be 1, 2, 3, ..., n from left to right respectively; That is to say, in the second line, from left to right, n+ 1, n+2, n+3, ..., 2n can be filled in separately; .................................................................................................................................................................................. diagonal exchange has two methods:
Method one; In the Rubik's cube, the center point is taken as the symmetrical point, and the diagonal number in the lower right corner is used to exchange the even number of the upper left area i+j; In the Rubik's Cube, take the center point as the symmetrical point, and exchange the odd number of i+j in the upper right area with the diagonal number in the lower left corner. (Make sure it is not even or odd at the same time. )
Method 2; Divide the magic square into m*m fourth-order magic squares, take the center point as the symmetry point, and exchange the diagonal numbers in each fourth-order magic square with those in the n-order magic square.
The fourth-order magic square generated by the spring method is as follows:
16 2 3 13
5 1 1 10 8
9 7 6 12
4 14 15 1 first construct the n-2 magic square, then add 2n-2 to all the numbers in it and put them in the middle of the n-order magic square, and then fill in the number of edges in this way. This method is suitable for all magic squares of n>4, and the mathematical model I built on February 3, 20021. YinMagic method can generate even magic squares of order 6 or above. The sixth-order magic square generated by YinMagic method is as follows:
10 1 34 33 5 28
29 23 22 1 1 18 8
30 12 17 24 2 1 7
2 26 19 14 15 35
3 1 13 16 25 20 6
9 36 3 4 32 27 If the magic square is regarded as an infinitely stretched figure, then the numbers in any adjacent n*n squares can form a magic square. The Rubik's Cube is called the Devil's Cube.
The Rubik's Cube constructed by the horse method I studied is the Devil's Cube. The Rubik's Cube below is the devil's Rubik's Cube, because the sum of four numbers in any two rows and two columns is 34. This magic square can be generated by YinMagic method.
15 10 3 6
4 5 16 9
14 1 1 2 7
1 8 13 12