magic square Algorithm

Beside this, depending on further property, magic squares are also classified as associative magic squares, pandiagonal magic squares, most-perfect magic squares, and so on. Moreover, the term" magic squares" is sometimes also used to refer to various types of word squares. Specimens of magic squares of order 3 to 9 look in an encyclopedia from Baghdad c.   983, the Encyclopedia of the Brethren of Purity (Rasa'il Ikhwan al-Safa).Also notable are the ancient cultures with a tradition of mathematics and numerology that make not observe the magic squares: Greeks, Babylonians, Egyptians, and Pre-Columbian Americans. By the end of 12th century, the general methods for constructing magic squares were well established.

magic square source code, pseudocode and analysis