eli@uw-june.UUCP (05/04/84)
Sorry--the array dimension for the magic square program should have been [1..n, 1..n]. ... uw-june!eli
eli@uw-june.UUCP (05/04/84)
The rules I learned for composing magic squares are indeed different for even and odd n. For even n, var square: array[1..20, 1..20] of integer; begin for i := 1 to n do for j := 1 to n do if (i = j) or (i = n - j + 1) then square[i, j] := n * (n - i) + (n - j + 1) else square[i, j] := n * (i - 1) + j; end; Conceptually you are numbering the squares not on the main diagonals, from left to right, top to bottom, counting up from 1 to n^2, and numbering the square on the main diagonal, from left to right, top to bottom counting down from n^2 to 1. ... uw-june!eli