Omnipotent Data

Chapter 105 Rubik's Cube Matrix

Rubik's cube matrix, also known as magic square, cross-section diagram.

It refers to an N-order matrix that is arranged by a total of N^2 numbers from 1 to N^2, has the same number of rows and columns, and has equal sums on each row, column, and diagonal.

In "Shooting the Condors", Guo and Huang were chased by Qiu Qianren to Heilongtan, where they hid in Yinggu's hut. Yinggu came up with a problem: fill in the numbers 1~9 in a three-row and three-column table, requiring that the sums of each row, each column, and two diagonal lines be equal. This question has stumped Ying Gu for more than ten years, but Huang Rong answered it right away.

4 9 2

3 5 7

8 1 6

This is the simplest third-order planar Rubik's cube matrix.

Today, the question posed by Old Tang is a more difficult fifth-order Rubik's Cube plane matrix.

The difficulty of calculation is much higher than that of the third-order Rubik's cube matrix.

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

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

When N is an odd number, when N is a multiple of 4, when N is other even numbers!

Old Tang's question is to find the fifth-order plane Rubik's cube. Obviously, the operation law that N is an odd number can be applied.

Cheng Nuo silently recalled in his mind how to fill in the flat Rubik's cube when N is an odd number.

"When N is odd

① Put 1 in the middle column of the first row;

②The numbers from 2 to n×n are stored according to the following rules in turn:

Walk in a 45° direction, such as up to the right

The number of rows stored in each number is reduced by 1 from the number of rows in the previous number, and the number of columns is reduced by 1

③If the range of rows and columns exceeds the range of the matrix, wrap around.

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

④ If there is a number at the position determined according to the above rules, or the last number is the first row and the nth column,

Place the next number below the previous number. "(Note ①)

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

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

Swish Swish Swish Swish ~~

In the eyes of the students, Cheng Nuo didn't hesitate to write on the blackboard with chalk, causing powder to fly. There is no pause in the middle, all in one go!

He raised his hands and feet, revealing an extremely powerful self-confidence.

"Okay, teacher, I'm done." Cheng Nuo turned around, threw the chalk stubs on the desk, and said to Old Tang with a smile.

"Okay, let me take a look, did you fill it in correctly?" Old Tang looked at the filled grid on the blackboard with a sense of curiosity.

15 8 1 24 17

16 14 7 5 23

22 20 13 6 4

3 21 19 12 10

9 2 25 18 11

all right! !

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

The sum of each row, each column, and each diagonal is 65! ~

Old Tang looked at Cheng Nuo, who looked normal, in surprise. Then, under the expectant eyes of the whole class, he announced, "Student Cheng Nuo's answer... is correct!"

Wow~~

The whole class was in an uproar.

Sure enough, Cheng Nuo is as tough as ever!

Can't compare, really can't compare.

Their brain configurations and Cheng Nuo's were simply not on the same level.

A top student is an existence worthy of being looked up to only by a scumbag!

Old Tang looked at Cheng Nuo and said, "Since Cheng Nuo is the first student to solve this problem, then my 'special' reward will belong to Cheng Nuo. Cheng Nuo, can you tell everyone about it?" How did you solve this problem?"

"no problem.

Cheng Nuo nodded, turned around and pointed to the question, "Actually, this question is very simple." "

This question... is very simple?

Well, you are a top student, you have the final say.

The whole class rolled their eyes.

Cheng Nuo shrugged, and continued to preach as usual. "Before I talk about this question, I want to tell you a model called Rubik's Cube Matrix!"

Why did Cheng Nuo know about the Rubik's cube matrix?

It stands to reason that in high school, this aspect of knowledge will not be involved.

But who is Cheng Nuo? He is a top student!

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

Remember the pile of books about the world's mathematical problems that Cheng Nuo bought back from the bookstore? In the reasoning process of one of the puzzles, this Rubik's cube matrix was used. Cheng Nuo wrote it down by the way.

Cheng Nuo stood on the podium and explained all three solutions to the Rubik's Cube matrix.

"After listening to this theorem, do you feel that this question is much simpler. First of all, the number in the middle of the first row must be 1, and the position of the number 2..."

The students under the podium were dizzy and didn't know what was going on, but Cheng Nuo talked with great interest on the podium.

"Okay, that's all I want to say, thank you everyone!" After speaking, Cheng Nuo stepped off the podium.

clap clap ~~

The whole class subconsciously applauded.

Comrade Old Tang waited for Cheng Nuo to step off the podium, and stood in front of the podium with an embarrassed expression on his face.

sister! I've said everything I want to say, what should I say? !

Originally, Comrade Tang wanted to use this topic to draw out the Rubik's Cube matrix and divert students' thinking before the college entrance examination.

But now...

Uh... Well, Cheng Nuo explained the Rubik's cube matrix in more detail than me, so I, as a teacher, should not make a fool of myself.

"Okay. Students, let's take out the set of Hengshui real questions that we sent out last week, and let's talk about that set of test papers." Old Tang coughed awkwardly, and hurriedly changed the subject without asking if the students understood. .

"Wow, Mu Leng, Cheng Nuo is really good. He can do such questions!" Su Xiaoxiao's bright eyes were full of little stars.

The corner of Mu Leng's mouth rose slightly, "This is the... the unruly him!"

…………

"Okay, get out of class is over. Mu Leng, Cheng Nuo, you two come with me to the office."

With the bell ringing for the end of get out of class, Old Tang just finished the last question.

Cheng Nuo and Mu Leng looked at each other, both confused, not knowing what Old Tang wanted from him, but they followed Old Tang to the office obediently.

When going down the stairs, Cheng Nuo leaned close to Mu Leng, and whispered with worry in his voice, "Sister Leng, do you think Old Tang found out about our relationship?"

Mu Leng glanced at Cheng Nuo indifferently, and said word by word: "You-say-!"

Cheng Nuo shrank his neck and looked embarrassed, "Just kidding, just kidding."

"However, Sister Leng, do you really stop thinking about the two of us? You see, you are a top student, and I am also a top student. A top student matches a top student. The two of us are a good match. The children born He must be a top student!" Cheng Nuo clenched his fists and said.

Mu Leng pursed his lips, and said ambiguously, "After the college entrance examination, let's talk about this issue."

"Okay, I'll wait for you." Cheng Nuo smiled faintly.

………………

Note ①: Algorithms for the other two cases of Rubik's cube matrix. (The main text has reached 2000 words. This is not a word count. This is to help everyone learn this question!! Please understand the author's good intentions.)

(2) When N is a multiple of 4

The symmetrical element exchange method is used.

First fill the numbers 1 to n×n into the matrix from top to bottom and from left to right

Then, the numbers on the two diagonals in all 4×4 sub-matrixes of the square matrix are exchanged symmetrically about the center of the large square matrix (note that the numbers on the diagonals of each sub-matrix), that is, a(i, j) is exchanged with a(n+1-i, n+1-j), and the numbers in all other positions remain unchanged. (Or keep the diagonal line unchanged, and other positions can be symmetrically exchanged)

(3) When N is other even numbers

When n is an even number that is not a multiple of 4 (that is, 4n+2 shape): first decompose the large square matrix into 4 odd number (2m+1 order) sub-square matrices.

Assign values ​​to the decomposed 4 sub-squares according to the above odd-order Rubik's Cube

The upper left sub-array is the smallest (i), the lower right sub-array is the smallest (i+v), the lower left sub-array is the largest (i+3v), and the upper right sub-array is the largest (i+2v)

That is, the difference between the corresponding elements of the 4 sub-square matrices is v, where v=n*n/4

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

Then do the corresponding element exchange: a(i, j) and a(i+u, j) are exchanged in the same column (j\u0026amp;amp;amp;lt;t-1 or j\u0026amp;amp;amp;gt;n -t+1),

Note where 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 two pairs of elements

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

…………

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

Tap the screen to use advanced tools Tip: You can use left and right keyboard keys to browse between chapters.

You'll Also Like