Magic squares. An n × n matrix that is filled with the numbers 1, 2, 3, ..., n^2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value....