Magic Squares

A Magic Square is an arrangement of the distinct positive integers such that the sum of all the rows, columns and main diagonals is always the same number. This Number that all Rows, Columns and main Diagonals add up to is known as the Magic Constant.
The Magic Constant for an Magic Square is represented by:
The logic behind this constant is very trivial and can be deduced by anyone who knows the following formula:
Yes. It is the sum of the first N Natural Numbers. In a Magic Square, the numbers that can be used are . Since we have the first Natural Numbers, the sum of the whole magic square is:
Also, the sum of each row (or column) is going to be same. Let it be . Then the total sum of the Square will be . This has to be equal to the total sum calculated above. So, the sum of numbers in each row (and hence, each column) is:
For a grid, there are possible arrangements that qualify as Magic Squares.
Note: The Magic Squares in this post have been generated by using a Brute Force Algorithm which goes through all possible permutations (about ; the next one for being ).