Magic black square. Magic square: how it works

Many Internet users have probably come across the site " http://www.ugbereg.ru/magic.htm ”, or the so-called “magic” square.
Many people probably believed that the square is actually able to "read minds",
Many understood that this was some kind of trick, and the fact that the square guesses the intended numbers can be explained in a logical way, but most of them did not guess how it works.
And, of course, there are people who have already unraveled the secret of the "magic" square.

I (Kaori Nakamura), together with my dad, understood how the “magic” square works and for what purposes it was created.
I was offended that Internet users were being so deceived, and I decided to tell them as best I could. more people the truth about this mind-reading site.

How the "magic" square works:

To begin with, let's try to take the number 99, subtract two nines from it, it turns out 81.
Let's take the number 98, 98-9-8=81. The same is true for the numbers 97, 96 and all the numbers in the first line.
Let's try to take the number 89 89-8-9=72, the same answer will be obtained for all numbers of the second line.
And so, in the entire third line - the number 63
In the whole fourth - 54, in the fifth - 45, in the sixth - 36, in the seventh - 27, in the eighth - 18, in the ninth - 9.

Now, note that each time you land on a page with a black square, the symbols next to the numbers are always different.

Now take a closer look at the table, the numbers: 81, 72, 63, 54, 45, 36, 27, 18 and 9 lie on the same diagonal, and have the same symbol, that is, no matter what two-digit number you think of, You will still get one of the above numbers. This means that the square symbol will show the same one.

If you try to simply take any number without any calculations, for example 12, then the square will make a mistake and show not the symbol that belongs to the number 12, but the one that belongs to the numbers 81, 72 and so on.

Therefore, there is no "magic" here.

Why is this needed?

Everyone who came across this "magic" square must have read this article:

“Tell about it on 3 favorite forums, or 7 friends on ICQ, and today you will meet fabulous luck and happiness, you will be fabulously lucky!

THIS IS HOW IT HAPPENED TO ME! At first I thought it was a joke. But still, for interest, I checked it - I really wanted something new and unusual. He told on three forums, and also on his blog. And in the evening, when I had already forgotten, I was driving from work in the subway, and at the next stop on the right, a very beautiful girl, slender with deep bright eyes. I almost shuddered from her eyes, face, hair, the aroma of her soft perfume ... When she reached into her purse, a cell phone fell out of the purse, right between my legs- magic square worked! She was shy, but asked me to get it. But I persuaded her to do it with my own hand =)) Yes! She did, with a brilliant smile! She turned out to be unexpectedly talkative, and I had such a feeling that she was my very close person I feel comfortable and at ease with her. It wasn't until I got back to work the next day that I remembered the magic square. We met twice already, and she smiled, and so did I. She was even prettier and more fun than I remembered her. We walked, laughed, I saw with what greedy eyes the other guys looked at her ... It’s easy for me with her, like with no one else. Square read my thoughts and fulfilled my secret desire! Tomorrow I will go to visit her;) I have never had such a thing in my life! Square DEFINITELY works! Tell others soon - may you be lucky!

P.S. But my friend didn’t send it and they pulled out his wallet with 300 dollars in the subway, who knows, maybe he was punished by the square? It's better to tell a link than like this .. "

And after reading this text, many (I do not say that all, but most) began to distribute these links right and left, no matter what they stole a wallet with trust dollars, which they never had.

So why was this site created? “in order to entertain Internet users?” No, this “magic” square is part of one commercial site, if you remove it from “ http://www.ugbereg.ru/magic.html » " magic.html", you will get a link to the MAIN page of this site: " http://www.ugbereg.ru/ ". This means that with our links, we help the website for the sale of apartments in the city of Bataysk to advance in the Yandex search line!

I tried to explain how this site works as clearly as possible, and I hope that all who read this text will understand my zeal to "expose" the site with the "magic" square.

If you have any questions - ask, I will answer.
But even if there are no questions, it is still extremely important for me to know your opinion about all this.

Thank you for your attention,
Your Kaori Nakamura.

The secret of the game "Magic Square"

I'm sure you've heard the phrase "magic square" somewhere. We know several representatives of this "tribe". The most common and often found on the Internet is the so-called Magic Square game. Its essence lies in the fact that your attention is invited to a table (this is the “magic square”), which is able to “guess thoughts”. Naturally, like any game, it has certain rules. It is necessary to think of any two-digit number, and then subtract from it the sum consisting of the digits of this number. Find the resulting value in the table along with the symbol corresponding to it. And just this symbol guesses the square. The game is funny and, at first glance, really magical, because no matter what number you think of initially, the square always guesses the symbol. How does it work? How does the "magic square" work? In fact, the answer lies on the surface. If you check the square several times in a row, you will notice that the same symbol falls out all the time. A closer look at the table shows that this symbol is located horizontally and it corresponds to numbers divisible by 9 without a remainder. However, only they are obtained in your answer, no matter what two-digit number you choose. We can say that we have exposed the "magic square". The secret lies not so much in him as in the conditions of the game. The fact is that there is such an indisputable truth that says: “If you subtract the sum of its digits from any two-digit number, you get a number that is divisible by 9 without a remainder.” So we figured out how the "magic square" works. Not an ounce of mysticism! Although, in principle, everything related to numbers is based on calculations and patterns, and not on magic.

The secret of the magic square:

7 t41 k86 h21 n33 w1 p35 r61 p12 w90 a
15 h23 z57 v55 q71 d66 h78 g14 q81 a 10 t
88 d59 j74 n69 b68 m38 i22 m72 a 3 v58 m
62 l77 m40 c98 u20 s94 m63 a 87 t99 m37 x
92 s96 g51 f73 e46 i54 a 53 s44 h43 k2 d
34 o31 e91 t19 i45 a 50 k85 v28 s38 l75 v
79 h8 c11 s36 a 16 f24 z4 q67 m6 f48 o
17 p65 w27 a 42 p89 e39 s95 x32 f25 d26 h
29 c18 a 82 k60 o93 r83 y52 k56 p53 i30 y
9 a 80 q47 d84 l5 g13 x70 d49 g76 c64 e

Albrecht Dürer's magic square

Sometimes digital patterns take on such incredible proportions that it seems that witchcraft has not been done here. So, for example, another “magic square” is known - Albrecht Dürer. In mathematics, it is understood as a square table with the same number of rows and columns, filled with natural numbers. Moreover, the sum of these numbers horizontally, vertically or diagonally should equal the same result. The magic square came to us from China, today we all know it bright representative- Sudoku crossword. In Europe, it was Dürer who was the first to depict a “magic” figure in his engraving “Melancholia”. What is the uniqueness of this "magic square"? At its base, it has a combination of numbers 15 and 14, which corresponds to the year of publication of the engraving. And the sum of the numbers is made up not only of the rows diagonally, vertically and horizontally, but also of the numbers standing at the corners of the square, in the central small square and in each of the four-cell squares on its sides. These figures do not predict fate and do not guess thoughts, they are unique precisely in their patterns.

Square of Pythagoras

If we turn to fortune-telling, then there is also a representative here - the “magic square” of Pythagoras. We all know this name from geometry lessons. But only in our time this person began to be called a mathematician and philosopher. In ancient times, he was known as a teacher of wisdom, poems were composed and odes were sung about him, he was worshiped, considered a seer. Pythagoras founded a new science - numerology, in former times it was perceived as a religion.

He believed that numbers can explain almost every phenomenon, including determining the fate of a person, telling about his character, talents and weaknesses. This could be done using the square of Pythagoras. How does the "magic square" work and what is it? The magic square of Pythagoras is a 3/3 square (rows, columns), in which the numbers from 1 to 9 are entered. The date of birth of a person is taken as the basis for the prediction. It is important that "0" does not appear in the calculations. With the help of simple calculations and formulas, a set of numbers is obtained, which subsequently must be entered into a square. Each number has its own meaning and is responsible for a certain property. So, 4 is “responsible” for health, and 9 is for the mind. Depending on how many times the same number occurs in your square, you can say about the predominance of one or another property. So, for example, the absence of 4 is an indicator of physical weakness and sickness, and 444 is an indicator of good health and cheerfulness. How true the square of Pythagoras is, it is difficult to say, as, indeed, any fortune-telling. But now, knowing how the magic square works, you can at least pass an hour or two pleasantly, calculating the characters of your friends and acquaintances.

In a magic square, integers are distributed in such a way that their sum horizontally, vertically, and diagonally equals the same number, the so-called magic constant.

The magic square in the cultures of the world

An example of a magic square is Lo Shu, which is a 3 by 3 table. The numbers from 1 to 9 are inscribed in it in such a way that each row and diagonal add up to 15.

One Chinese legend tells how one day, during a flood, the king tried to build a canal that would divert water to the sea. Suddenly, a turtle with a strange pattern on its shell appeared from the Lo River. It was a grid with numbers from 1 to 9 inscribed in squares. The sum of the numbers on each side of the square, as well as along the diagonal, was 15. This number corresponded to the number of days in each of the 24 cycles of Chinese solar year.

The Luo Shu square is also called the magic square of Saturn. In the bottom row of this square in the middle is the number 1, and in the upper right cell the number 2.

The magic square is also present in other cultures: Persian, Arabic, Indian, European. It was captured in his engraving "Melancholy" in 1514 by the German artist Albrecht Dürer.

The magic square on Durer's engraving is considered the first of those that have ever appeared in European artistic culture.

How to solve the magic square

The magic square should be solved by filling the cells with numbers in such a way that the sum of each line is a magic constant. The side of the magic square can consist of an even or odd number of cells. The most popular magic squares consist of nine (3x3) or sixteen (4x4) cells. There is a wide variety of magic squares and options for solving them.

How to solve a square with an even number of cells

You will need a sheet of paper with a 4x4 square drawn on them, a simple pencil and an eraser.

Enter numbers from 1 to 16 in the cells of the square, starting from the top left cell.

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

The magic constant of this square is 34. Swap the numbers for diagonal line from 1 to 16. For simplicity, swap 16 and 1, and then 6 and 11. As a result, the numbers 16, 11, 6, 1 will be on the diagonal.

16 2 3 4
5 11 7 8
9 10 6 12
13 14 15 1

Swap the numbers on the second diagonal line. This line starts at 4 and ends at 13. Swap them. Now swap the other two numbers - 7 and 10. From top to bottom on the line, the numbers will be arranged in this order: 13, 10, 7, 4.

16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1

If you count the sum on each line, you get 34. This method works with other squares with an even number of cells.

There are several different classifications of magic squares.

fifth order, designed to somehow systematize them. In the book

Martin Gardner [GM90, pp. 244-345] describes one of these methods -

according to the number in the central square. The method is curious, but nothing more.

How many squares of the sixth order exist is still unknown, but there are approximately 1.77 x 1019. The number is huge, so there is no hope of counting them using exhaustive search, but no one could come up with a formula for calculating magic squares.

How to make a magic square?

There are many ways to construct magic squares. The easiest way to make magic squares odd order. We will use the method proposed by the French scientist of the 17th century A. de la Louber (De La Loubère). It is based on five rules, the operation of which we will consider on the simplest magic square 3 x 3 cells.

Rule 1. Put 1 in the middle column of the first row (Fig. 5.7).

Rice. 5.7. First number

Rule 2. Put the next number, if possible, in the cell adjacent to the current one diagonally to the right and above (Fig. 5.8).

Rice. 5.8. Trying to put the second number

Rule 3. If new cage goes beyond the square above, then write the number in the lowest line and in the next column (Fig. 5.9).

Rice. 5.9. We put the second number

Rule 4. If the cell goes beyond the square on the right, then write the number in the very first column and in the previous line (Fig. 5.10).

Rice. 5.10. We put the third number

Rule 5. If the cell is already occupied, then write down the next number under the current cell (Fig. 5.11).

Rice. 5.11. We put the fourth number

Rice. 5.12. We put the fifth and sixth number

Follow Rules 3, 4, 5 again until you complete the entire square (Fig.

Isn't it true, the rules are very simple and clear, but it's still quite tedious to arrange even 9 numbers. However, knowing the algorithm for constructing magic squares, we can easily entrust the computer with all the routine work, leaving ourselves only creative work, that is, writing a program.

Rice. 5.13. Fill in the square with the following numbers

Project Magic squares(Magic)

Field set for the program magic squares quite obvious:

// PROGRAM FOR GENERATION

// ODD MAGIC SQUARE

// BY THE DE LA LOUBERT METHOD

public partial class Form1 : Form

//Max. square dimensions: const int MAX_SIZE = 27; //var

intn=0; // square order int [,] mq; // magic square

int number=0; // current number to square

intcol=0; // current column int row=0; // current line

De la Louber's method is suitable for making odd squares of any size, so we can give the user the opportunity to choose the order of the square, while reasonably limiting the freedom of choice to 27 cells.

After the user presses the coveted button btnGen Generate! , the btnGen_Click method creates an array to store numbers and passes into the generate method:

// PRESS THE "GENERATE" BUTTON

private void btnGen_Click(object sender,EventArgs e)

//order of the square:

n = (int)udNum.Value;

//create an array:

mq = new int ;

//generate magic square: generate();

lstRes.TopIndex = lstRes.Items.Count-27;

Here we begin to act according to the rules of de la Louber and write the first number - one - in the middle cell of the first row of the square (or array, if you like):

//Generate the magic square void generate()(

//first number: number=1;

//column for the first number - middle: col = n / 2 + 1;

//line for the first number - the first one: row=1;

//square it: mq= number;

Now we sequentially add the rest of the cells in cells - from two to n * n:

//go to next number:

We remember, just in case, the coordinates of the actual cell

int tc=col;int tr = row;

and move to the next cell diagonally:

We check the implementation of the third rule:

if (row< 1) row= n;

And then the fourth:

if (col > n) ( col=1;

goto rule3;

And fifth:

if (mq != 0) ( col=tc;

row=tr+1; goto rule3;

How do we know that there is already a number in the cell of the square? - Very simple: we prudently wrote zeros in all cells, and the numbers in the finished square are greater than zero. So, by the value of the array element, we will immediately determine whether the cell is empty or already with a number! Please note that here we need those cell coordinates that we remember before searching for the cell for the next number.

Sooner or later, we will find a suitable cell for the number and write it to the corresponding array cell:

//square it: mq = number;

Try another way to organize the check of the admissibility of the transition to the

wow cell!

If this number was the last, then the program has fulfilled its obligations, otherwise it voluntarily proceeds to provide the cell with the following number:

//if not all numbers are set, then if (number< n*n)

//go to the next number: goto nextNumber;

And now the square is ready! We calculate its magic sum and print it on the screen:

//square completed: writeMQ();

) //generate()

Printing the elements of an array is very simple, but it is important to take into account the alignment of numbers of different "lengths", because a square can contain one-, two-, and three-digit numbers:

//Print the magic square void writeMQ()

lstRes.ForeColor = Color .Black;

string s = "Magic sum = " + (n*n*n+n)/2; lstRes.Items.Add(s);

lstRes.Items.Add("" );

// print the magic square: for (int i= 1; i<= n; ++i){

s="" ;

for (int j= 1; j<= n; ++j){

if (n*n > 10 && mq< 10) s +=" " ;if (n*n >100 && mq< 100) s +=" " ; s= s + mq +" " ;

lstRes.Items.Add(s);

lstRes.Items.Add("" ); )//writeMQ()

We launch the program - the squares are obtained quickly and feast for the eyes (Fig.

Rice. 5.14. Quite a square!

In the book by S. Goodman, S. Hidetniemi Introduction to the development and analysis of algorithms

mov , on pages 297-299 we will find the same algorithm, but in a "reduced" presentation. It is not as "transparent" as our version, but it works correctly.

Add a button btnGen2 Generate 2! and write the algorithm in the language

C-sharp to methodAn old algorithm in a new guise

In ancient times, great scientists considered numbers to be the basis of the essence of the world. The magic square, the secret of which is that the sum of the numbers in the resulting square in each horizontal, in each vertical, and in each diagonal is the same, carries this essence.

But complete description Magic squares do not exist to date.

The magic square of Pythagoras, "attracting" the energy of wealth, was compiled by the founder
The great scientist, who founded the religious and philosophical doctrine and proclaimed quantitative relations the basis of things, believed that a person's essence lies in the date of birth of a person.

Knowing how the magic square works, one can not only find out the character traits of a person, his state of health, his intellectual and creative abilities, but also draw up a program for his improvement and development. The numbers, which are written in a square in a special way, attract not only wealth, but also the necessary energy flows for a person. For example, Paracelsus depicted his square as a talisman of health. The numbers form three rows, that is, there are nine numbers in a square. To determine your numerological code, you need to calculate these nine numbers.

How does the magic square work?

The first horizontal row of the square is formed by numbers: the day, month and year of a person's birth. For example, the date of birth of a person corresponds to 08/09/1971. Then the first number in the square will be 9, which is written in the first cell. The second number is the number of the month, i.e. 8.

At the same time, it is worth paying attention if the month of a person’s birth corresponds to December, that is, the number 12, then it, therefore, must be converted by addition to a simple number 3. The third digit corresponds to the number of the year. To do this, it is necessary to decompose 1971 into composite numbers and calculate their total amount equal to 18 and further simplify 1 + 8 = 9. We fill in the upper horizontal field of the square with the resulting numbers: 9,8,9.

In the second row of the square, numbers are written corresponding to the name, patronymic and surname of a person according to numerology. Each letter has its own numerical value. Numbers can be obtained from the correspondence table of letters and numbers by numerology. Next, you need to sum up the numbers of the first name, patronymic and last name and bring them to simple values.

The second row of the square is filled with the resulting numbers. The fourth number corresponds to the number of the name, the fifth - to the patronymic, and the sixth - to the surname. Now we have the second line of the energy square.

A further principle of how the magic square works is based on astrology.

The seventh digit corresponds to the number of the person's zodiac sign. Aries is the first sign under the number 1, and then in order to the sign of Pisces - 12. When filling out the third row of the square double figures you should not lead to simple ones, they all have their own meaning.

The eighth digit is the number of the sign according to That is, in our version, 1971 is the year of the Boar.

The ninth digit represents the numerological code of a person's desire. For example, a person strives to have excellent health, therefore, you need to find the numbers corresponding to the letters in this word. The result is 49, which is then simplified by addition to 4. Numbers from 10 to 12, as in the case of a person's zodiac sign, do not need to be reduced. Now, knowing how the magic square works, you can easily compose it and carry it with you like a talisman or decorate it like a picture and hang it at home.

What else to read