Chapter 104

Magic square matrix, also known as magic square, vertical and horizontal diagram.

It refers to an n-order matrix with the same number of rows and columns arranged by 1 ~ n ^ 2, and the sum of each row, column and diagonal is equal.

In shooting sculpture, Guo and Huang are chased by Qiu Qianren to the black dragon pool and hide in yinggu's hut. Yinggu put forward a question: the numbers 1-9 should be filled in the form of three rows and three columns, and the sum of each row, each column and two diagonal lines should be equal. This question has puzzled yinggu for more than ten years, and Huang Rong immediately answers it.

492

357

816

this is the simplest cubic plane magic square matrix.

Today's problem by Lao Tang is a more difficult five order magic square plane matrix.

The difficulty of calculation, I don't know how much higher than the third order magic square matrix.

However, since Rubik's cube matrix has been defined by mathematicians, it naturally has a set of unique operation rules.

According to the value of N, it can be divided into three cases.

When n is odd, when n is a multiple of 4, when n is any other even number!

The problem of Old Tang is to find a 5-order plane magic square. Obviously, we can apply the operation law of n as odd number.

Cheng Nuo quietly recalled in his mind when n is an odd number, the law of filling in the plane Rubik's cube.

"When n is an odd number,

① place 1 in the middle of the first row;

② store the numbers from 2 to n × n according to the following rules:

walk along 45 ° direction, for example,

to the right,

the number of rows stored in each number is 1 less than that of the previous number, and the number of columns is reduced by 1

③ if the range of rows and columns exceeds the range of matrix, it will be wrapped.

For example, if 1 is in the first row, then 2 should be placed in the bottom row, and the number of columns should also be reduced by 1;

④ if there is a number in the position determined according to the above rules, or if the previous number is the nth column in the first row,

then the next number will be placed under the previous number. " (Note 1)

"therefore, the correct answer should be..."

Cheng Nuo builds a grid model in his mind. Soon, 25 numbers were filled in.

Shua Shua Shua ~ ~

in the eyes of the students, Cheng Nuo did not have any hesitation. He took the chalk and wrote away the dragon and snake on the blackboard, and the dust was flying. There is no pause in the middle!

Raising hands and feet, revealing a very strong confidence.

"Well, teacher, I'm done." Cheng Nuo turns and throws the chalk head on the desk and says to Old Tang with a smile.

"Well, let me see. Are you right?" With a curiosity, old Tang looked at the filled Palace on the blackboard.

15812417

16147523

22201364

321191210

92251811

all correct!!

The position of 25 numbers is exactly the same as the correct answer.

The sum of every row, every column, every diagonal is 65! ~

Old Tang took a surprised look at Cheng Nuo. Then, under the expectant eyes of the whole class, he announced, "the answer of Cheng Nuo It's right! "

Whoa ~ ~

the whole class was in a state of uproar.

Sure enough, Cheng Nuo is as tough as ever!

It can't be compared. It can't be compared.

Their brain configuration with Cheng Nuo is not on the same level.

Xueba is only worthy of being looked up to by Xueba!

Old Tang looked at Cheng Nuo and said, "since Cheng Nuo is the first student to solve this problem, my" special "reward will go back to Cheng Nuo. Cheng Nuo, can you tell us how you solved this problem? "

"No problem." Cheng Nuo nodded, turned to point to the problem and said, "in fact, this problem is very simple."

This question It's simple? Has the final say,

, you are the curve wrecker.

The whole class rolled their eyes.

Cheng Nuo shrugged and continued to preach. "Before I talk about this problem, I'd like to tell you a model called Rubik's cube matrix!"

Why can Cheng Nuo know the Rubik's cube matrix?

Normally speaking, senior high school will not involve this kind of knowledge.

But who is Cheng Nuo? He's a bully!

One of the characteristics of Xueba is that you will never be satisfied with learning only the knowledge in class!

Do you remember the pile of books about the world's mathematical problems that Cheng bought back from the bookstore? The Rubik's cube matrix is used in the reasoning process of one of the problems. Cheng Nuo wrote it down by the way.

Cheng Nuo stood on the podium, will Rubik's cube matrix of the three solutions are told once.

"After listening to this theorem, do you think the problem is much simpler. First of all, the number in the middle of the first line must be 1, the position of number 2... "Under the platform, the students were dizzy and confused. Cheng Nuo talked on the platform with relish.

"Well, that's all I want to say. Thank you very much." With that, Cheng Nuo stepped down from the platform.

Pa Pa ~ ~

the whole class applauded subconsciously.

After Cheng Nuo stepped off the platform, Comrade Tang stood in front of the desk with an embarrassed face.

Girl! Finish what I want to say. What can I say?!

Mr. Tang's thinking matrix was introduced to the students before the college entrance examination.

But now

Er Well, Cheng Nuo told me more about the Rubik's cube matrix than I did, so I'm not going to make a fool of myself as a teacher.

"All right. Let's take out the set of questions in the paper Old Tang coughed awkwardly for a while, and did not ask the students if they understood. He quickly changed the topic.

"Wow, Muleng, Cheng Nuo is really good. Such questions can be used! " Sue's little bright eyes were full of little stars.

Mu Leng's mouth rose slightly, "this is the The rebellious one

…………

"Well, class is over. Mullen and Chenault, you two come to the office with me

With the bell ringing, old Tang just finished the last question.

Cheng Nuo and Mu Leng look at each other. They are all in a fog. They don't know what Lao Tang is looking for, but they still follow him to the office.

When he went down the stairs, Cheng Nuo got close to Mu Leng and whispered in a slightly worried voice, "sister Leng, do you think that we two fell in love with each other by the old Tang?"

Mu Leng glanced at Cheng Nuo lightly and said, "you say it!"

Cheng Nuo shrunk his neck, a face chat up, "joking, joking."

"But, sister Leng, do you really stop thinking about us? You see, you are Xueba, and I am Xueba. Xueba is matched with Xueba. We can be said to be in a good match. The children born must be Xueba! " Cheng Nuo clenched his fists and said.

Mu Leng pursed her lips and said ambiguously, "after the college entrance examination, we are talking about this problem."

"OK, I'll wait for you." Cheng Nuo smiles faintly.

………………

Note 1: the algorithm of the other two cases of magic square matrix. (the number of words in the text has reached 2000, which is not the number of water words. This is to help you learn this problem!! Please understand the author's good intentions.)

(2) When n is a multiple of 4, the symmetry element exchange method is used.

Firstly, the numbers from 1 to n × n are filled in the matrix from top to bottom and from left to right in order

then the numbers on the two diagonals of all 4 × 4 sub matrices of the square matrix are symmetrically exchanged with respect to the center of the square matrix (note that the number above the diagonal of each sub matrix) is exchanged, that is, a (I, J) is exchanged with a (n + 1-I, N + 1-J), and the numbers at all other positions remain unchanged. (3) when n is any other even number

when n is an even number (i.e. 4N + 2 shape), the large square matrix is first decomposed into four odd (2m + 1 order) submatrix.

According to the odd order Rubik's cube of odd order, the corresponding values of the four sub matrices are assigned

the upper left subarray is the smallest (I), the lower right subarray is the second smaller (I + V), the lower left subarray is the largest (I + 3V), and the upper right subarray is the second largest (I + 2V)

that is, the difference of the corresponding elements of the four subarrays is V, where V = n * N4

the arrangement of the four sub matrices from small to large is ① ③ ④ ②

and then the corresponding element exchange is made: a (I, J) Do the corresponding exchange with a (I + U, J) in the same column (J & & T-1 or J & & amp; N-t + 1),

note that J can go to zero.

A (t-1, 0) and a (T + U-1, 0); a (t-1, t-1) and a (T + U-1, t-1) exchange

where u = N2, t = (n + 2) 4. The above exchange makes the sum of elements in each row and column equal to the sum of the elements on the two diagonals.

…………

PS: I have detailed the steps to this extent. If you don't I can't help it.

www.novelhold.com , the fastest update of the webnovel!