Magic squares A magic square of order n is an arrangement of the integers from 1 to n2 in an n × n matrix, with each number occurring exactly once, so that each row, each column, and each main diagonal has the same sum.
a. Prove that if a magic square of order n exists, the sum in question must be equal to n(n2 + 1)/2.
b. Design an exhaustive-search algorithm for generating all magic squares of order n.
c. Goto the Internet or your library and find a better algorithm for generating magic squares.
d. Implement the two algorithms—the exhaustive search and the one you have found—and run an experiment to determine the largest value of n for which each of the algorithms is able to find a magic square of order n in less than 1 minute on your computer.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.