This page was formerly at:

http://users.eastlink.ca/~sharrywhite/MagicSquares.html

Linux Programs macOS Programs Bordered Magic Rectangles Magic Square Art

Magic Squares

Introduction

A normal magic square of order n contains the integers 1, 2, ..., n² arranged such that the sum of the numbers in any row, column, or main diagonal is the same:

n(n²+1)/2

This is called the magic constant.

All unqualified references to magic squares on this site mean normal magic squares.

Programs on the Downloads page make many specific types of magic squares. Magic squares can also be made with MagicRectangles, the CompleteSquare utility, and SODLS.

Bones

Subtracting the average of the numbers in the square, (n²+1)/2, from each number, yields a skeleton square of normalized numbers, "the bones", consisting of positive and negative numbers, and, for odd order squares, 0. This is a convenient way of seeing symmetry in the square. It can also facilitate square construction, transforms, and analysis. Conveniently, commonly used sums like the magic constant and the complementary pair total, are 0 in the bones.

Note: In many places on this site, the minus sign and ½ are omitted from bones images. Plus and minus numbers are generally distinguished by red and blue colors.

Example Squares: Order 3, 4, 5

Order 3 Square

There is 1 distinct, that is, not including rotations and reflections, magic square of order 3. It was known to the ancient Chinese, who called it the Lo Shu.

Order 3 square and bones

Notice that the complementary pairs of the square, i.e., pairs of numbers whose sum is n² + 1, appear as ± pairs in the bones.

Order 4 Squares

There are 880 distinct magic squares of order 4. These were enumerated by Bernard Frénicle de Bessy in the 17th century. The square shown here is called Dürer's magic square.

Order 4 square and bones

Order 5 Squares

There are 275,305,224 distinct magic squares of order 5. The number was first computed by Richard Schroeppel in 1973.

Order 5 square and bones

Freeware Disclaimer

The software on this site may be used freely.
You should use only if you agree to the freeware disclaimer.

Please send errata or comments to Harry White, sharrywhite@budshaw.ca

REFERENCES

Andrews, W.S. "Magic Squares and Cubes" https://archive.org/details/MagicSquaresAndCubes_754

Boyer, Christian "multimagic squares site" http://www.multimagie.com/indexengl.htm

Breedijk, Arie "Magic square" http://www.dutchmagicsquares.com/magic-square-eng/

Campbell, Dwane H. and Keith A. Campbell "WELCOME TO MAGIC CUBE GENERATOR" http://magictesseract.com.

Danielsson, Holger "Magic Squares" https://www.magic-squares.info/en.html

Darling, David "magic square" http://www.daviddarling.info/encyclopedia/M/magic_square.html

de Winkel, Aale "The Magic Encyclopedia" http://magichypercubes.com/Encyclopedia/

Gaspalou, Francis "Magic Squares" http://www.gaspalou.fr/magic-squares/

Golunski, Bogdan "NUMBER GALAXY" http://www.number-galaxy.eu/

Grogono, Alan W. "Grogono Magic Squares" http://www.grogono.com/magic/

Heinz, Harvey "Magic Squares" http://recmath.org/Magic%20Squares/

Knecht, Craig "Knecht Magic Squares" http://www.knechtmagicsquare.paulscomputing.com/

Meyer, H.B. "Magic Squares and Cubes" http://www.hbmeyer.de/magic.htm

Nakamura, Mitsutoshi "Magic Cubes and Tesseracts" http://magcube.la.coocan.jp/magcube/en/

Öfverstedt, Johan "Water Retention on Magic Squares Solver" http://sourceforge.net/projects/wrmssolver/

Suzuki, Mutsumi "Magic Squares" http://web.archive.org/web/20060709213003/http://mathforum.org/te/exchange/hosted/suzuki/MagicSquare.html

Taneja, Inder J. "Numbers Magic" https://inderjtaneja.com/

Trump, Walter "Notes on Magic Squares" http://www.trump.de/magic-squares/index.html

Weisstein, Eric W. "Magic Square." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/MagicSquare.html

Walkington, William "Magic Squares, Spheres and Tori" https://carresmagiques.blogspot.com