Current location - Training Enrollment Network - Mathematics courses - How to solve the problem of 100 per line in Jiugongge?
How to solve the problem of 100 per line in Jiugongge?
Magic phalanx

Open Classification: Science, Mathematics and Mathematical Models

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 the grid of n*n, so that the numbers in each row, column and diagonal of the grid are equal.

I have been interested in this for a long time, and I have gained something.

8 1 6

3 5 7

4 9 2

This mathematical model was built on September 26th, 1999 by/kloc-0.

Odd order magic square

When n is odd, we call the magic square an odd magic square. It can be realized by Merzirac method and loubere method. According to my research, it is found that a more magical Rubik's Cube can also be constructed through chess posture, so it is named Mafa.

Even order magic square

When n is even, we call the magic square an even magic square. When n is divisible by 4, we call the even magic square a dichotomy magic square. When n is not divisible by 4, we call this even magic square simple even magic square. It can be realized by Hire method, Strachey and YinMagic. Strachey is a single couple model. I modified the double couple (4m order) and made another feasible mathematical model, called spring. YinMagic is a model I designed in 2002. It can generate any even magic square.

Before filling in the magic square, we make the following agreement: if the number is beyond the scope of the magic square, then the magic square is regarded as a graph that can be stretched indefinitely, as shown in the following figure:

Merzirac method for generating magic square

Put 1 in the square in the middle of the first line, and fill in 2, 3, 4… in the upper left. If there is a number in the upper left corner, move down one space to continue filling. 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

Generating odd-order magic squares by loubere method

Put 1 in the middle box, and fill in 2, 3, 4 in the upper right … If there are numbers in the upper right corner, move up two boxes to continue filling. 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 2 1 1 20

Generating odd-order magic squares by horse method

First, put 1 in any box. 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.

Generating even-order magic squares by Hire method

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 64

Strachey method for generating simple even magic squares

The simple even magic square of order n is expressed as the magic square of order 4m+2. 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 m cells in the middle row of A, where 1 cells are in the middle of the row, M- 1 cells are arbitrary, and the left edges of other rows take m columns, which are interchanged with the corresponding cells of 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 29 13 18 1 1

Generating even magic squares by spring method

The n-order dichotomy magic square is expressed as the 4m-order magic square. 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; Swap the odd number of the upper right area i+j with the diagonal number of the lower left corner with the center point as the symmetrical point in the Rubik's Cube. (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

YinMagic constructs even-order magic squares

Firstly, the n-2 magic square is constructed, then all the numbers in it plus 2n-2 are placed in the middle of the N-order magic square, and then the number of edges is filled 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

Devil's cube

If the Rubik's cube is regarded as an infinitely stretched figure, then the numbers in any adjacent n*n squares can form a Rubik's cube. 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

Robfa:

1 is located in the center of the uplink, and it is arranged at the upper right once.