Magic square algorithm ```Name: ankur srivastava Status: N/A Age: N/A Location: N/A Country: N/A Date: Around 1995 ``` Question: Suppose there is a matrix N x N. You have to put non-repetitive positive integers in each square that is a matrix element. For example, rc (i,j) where i = 1 to N, j = 1 to N, so that the sum of each row, column, and diagonal is the same. Is there an algorithm to calculate a series of sums? Is there an algorithm which can tell for a given sum whether a matrix can be formed and what each element rc(i, j) would be and whether this can be generalized for any matrix size N x N? Replies: The type of matrix you are trying to construct is called a magic square. Most libraries with a reasonable math collection should have something available by searching under those key words. With luck you will find Durer's "Melancholia" engraving of 1514 with spectacular analysis of its substantial "magic" that goes way beyond the basic requirements. It is shown below. ``` 16 3 2 13 5 10 11 8 9 6 7 12 4 15 14 1 ``` tee Click here to return to the Mathematics Archives

NEWTON is an electronic community for Science, Math, and Computer Science K-12 Educators, sponsored and operated by Argonne National Laboratory's Educational Programs, Andrew Skipor, Ph.D., Head of Educational Programs.

For assistance with NEWTON contact a System Operator (help@newton.dep.anl.gov), or at Argonne's Educational Programs