Magic Squares
Previus Credits Index Next

What is a magic square?
Look at this simple example:

          2  9  4 
          7  5  3
          6  1  8	
Now, sum all the value is rows, in columns and in the two diagonal: you must obtain the same value: 15.
Ok, now I have understand.

Given a order N, a square of that order is a matrix of N*N cells; each cells may contain one (and only one) of the number from 1 to N*N. We call that square a magic square if the sum of all the rows, the columns and the two diagonal give the same value: the magic constant.

The magic constant depends from the order. In fact for calculating it we must sum all the number from 1 to N*N and than divide it for N (this is because the magic constant multiplies for the number or rows (or columns) may give the total sum of the square).

So the equation for calculating the constant is:

       Magic Constant = N*(N*N+1)/2
The first orders give these magic constants:
        3      15
        4      34
        5      65
        6     111
        7     175
Now I don't want to analyze these kind of magic square (we should want to be able to build some of them, or know how many squares there are for each orders, ...), because I will analyze a particular class of magic square.

Magic Square Research Tognon Stefano Research