The 3x3 magic square is the earliest known magic square. It dates back to Chinese mythology, you can read the story here. People normally say there is only one 3x3 magic square. In one sense this is true, in another it is not.
It is true because all the 3x3 magic squares are related by symmetry. Once you have one, you can get all the others by turning or flipping the one you found. Have a careful look, and you'll see that each of the 3 by 3 magic squares in the grid above can be changed into its neighbors by flipping it, as if through a mirror.
Another way to change a 3x3 magic square into another is by subtracting all the numbers from So, for example,. There are only three pairs that sum to They are 2,9 , 3,8 and 5,6.
Therefore, 4 cannot be in the center and that leaves the only possible center number to be 5. Property 2. No corner cell can contain an odd integer. Without loss of generality, we can restrict our attention to the upper-left corner cell. Suppose that cell contains 1.
We now know that 5 must be in the center cell, so the number in the diagonally opposite cell from 1 must be 9. Now, in order to sum to 15 the top row must contain the numbers 1, 6, and 8. If either the 6 or 8 is in the corner cell then, since that column has 9 in its bottom cell, the sum of that column is more than Tis same aregument will also show that 9 cannot be in a corner.
Suppose the upper-left corner contains 3. That means the upper row must be the numbers 3, 4 and 8. Related Articles. Table of Contents. Save Article. Improve Article. Like Article. Recommended Articles. Minimize cost to convert a given matrix to another by flipping columns and reordering rows. Divide Matrix into K groups of adjacent cells having minimum difference between maximum and minimum sized groups.
Check if matrix can be converted to another matrix by transposing square sub-matrices. Article Contributed By :.
Easy Normal Medium Hard Expert. Writing code in comment?
0コメント