# Magic Square Construction Algorithms and Their Applications

The IUP Journal of Computational Mathematics, Vol. III, No. 3, pp. 34-50, September 2010

Posted: 29 Sep 2010

Date Written: September 28, 2010

### Abstract

In recreational mathematics, a magic square of order n is an arrangement of n2 numbers, usually distinct integers, in a square, such that the sum of n numbers in all rows, all columns and both diagonals is the same constant called the magic number. The magic square in normal is represented using n x n matrix. A normal magic square contains the integers from 1 to n2. Normal magic squares exist for all orders n is greater than or equal to 1, except n = 2. The magic constant for normal magic squares of order n is given by n(n2 + 1)/2. There are several methods for constructing the magic square of any given order. This paper proposes algorithms to obtain the magic square of any given order n. Some of the algorithms are straight forward and others are designed using the divide and conquer technique.

**Keywords:** Magic square, Magic constant, Divide and conquer, Increment decrement, Swap

**Suggested Citation:**
Suggested Citation