universal data

Chapter 104 Rubik's Cube Matrix

Chapter 104 Rubik's Cube Matrix
Rubik's cube matrix, also known as magic square, vertical and horizontal diagram.

It refers to an N-order matrix that is arranged by a total of N^1 numbers from 2 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 plane Rubik's cube matrix.

The question Lao Tang asked today was 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 number!
Lao Tang's question is to find a fifth-order plane Rubik's Cube. Obviously, the calculation rule 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;
② Starting from 2 and ending with n×n, the numbers are stored according to the following rules:

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

The number of rows where each number is stored is reduced by 1, and the number of columns is reduced by 1 from the previous number.
③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 1 should be placed in the bottom row, and the number of columns is also reduced by 2;
④ If there is already a number at the position determined according to the above rules, or if the last number is the first row and the nth column,

Then put 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 showed no hesitation as he took the chalk and wrote on the blackboard, causing dust 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've finished filling it out." Cheng Nuo turned around, threw the chalk 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 positions of the 25 numbers are 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, "Classmate Cheng Nuo's answer... is correct!"

wow~~
The whole class was in an uproar.

Sure enough, Cheng Nuo is as tough as ever!

It can't be compared, it really can't be compared.

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, my 'special' reward will go to Cheng Nuo. Cheng Nuo, can you tell everyone 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 it easy?
Well, you are the 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 about a model first, called the Rubik's Cube Matrix!"

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

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

But who is Cheng Nuo?He is a top student!
One of the characteristics of academic masters is that they are never satisfied with just learning the knowledge in class!
Remember the pile of books about the world's math 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 Lao Tang wanted to use this question to elicit the Rubik's Cube matrix and diversify 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 answer such questions!" Su Xiaoxiao's bright eyes were filled with little stars.

The corners of Mu Leng's mouth raised slightly, "This is 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 in a slightly worried tone, "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."

"But, Sister Leng, do you really no longer think 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 perfect match. The child we gave birth to He must be a top student!" Cheng Nuo said, clenching his fists.

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

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

………………

Note ①: Algorithms for the other two cases of the Rubik's Cube matrix. (The main text has reached 2000 words. This is not a water 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

Use the symmetric element exchange method.

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
当n为非4倍数的偶数(即4n+2形)时:首先把大方阵分解为4个奇数(2m+1阶)子方阵。

According to the above odd-order Rubik's Cube, assign values ​​to the four decomposed sub-square matrices.

The upper left subarray is the smallest (i), the lower right subarray is the smallest (i+v), the lower left subarray is the largest (i+3v), and the upper right subarray is the largest (i+2v)
That is, the corresponding elements of the four sub-square matrices differ by 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<t-1 or j>n-t+1 ),

Note where j can go to zero.

a(t-1,0)与a(t+u-1,0);a(t-1,t-1)与a(t+u-1,t-1)两对元素交换
Among them 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 steps to solve the problem to this extent.If you don't... I can't help it.

 Ask for collection, please recommend! !
  


(End of this chapter)

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

You'll Also Like