Second Summer 2006


Lecture Notes Fifteen: Magic Squares.
Implement the following procedure to construct magic n-by-n squares;

Here's the 5-by-5 square that you get if you follow this method:

 11  18   25    2    9 
 10  12   19   21    3 
  4   6   13   20   22 
 23   5    7   14   16 
 17  24    1    8   15 
Check that the square above is magic.

Calculate the 3-by-3, 7-by-7 and 13-by-13 magic squares.


Last updated: July 16, 2006 by Adrian German for A201/A597