Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site uw-june Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!hogpc!houti!ariel!vax135!cornell!uw-beaver!uw-june!eli From: eli@uw-june.UUCP Newsgroups: net.math Subject: Re: n x n magic squares, even n Message-ID: <1383@uw-june> Date: Fri, 4-May-84 15:11:12 EDT Article-I.D.: uw-june.1383 Posted: Fri May 4 15:11:12 1984 Date-Received: Sat, 5-May-84 01:44:33 EDT References: <551@aecom.UUCP> Organization: U. Washington, Computer Sci Lines: 20 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