Search for a tool
Magic Square

Tool to generate magic squares size N, kind of matrices composed of distinct integers set such as the sum of any line or column are equal.

Results

Magic Square -

Tag(s) : Number Games, Fun/Miscellaneous, Arithmetics

Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Thanks to your feedback and relevant comments, dCode has developed the best 'Magic Square' tool, so feel free to write! Thank you!

# Magic Square

## Magic Square Solver

### How to create a magic square of odd order?

Formula: Set number 1 on the left of the median line, the other numbers are written following the rule: if the cell is empty, in the cell in the bottom right of the previous one, else directly to the left of the occupied cell. When the cell does not exist (after last column or last row), go to the other side of the square/matrix.

### What are the minimal possible sums (magic values)?

The constant values $M$ of the sums of the magic squares have a minimum value (for non-zero integer positive values).

$$M = n (n ^ 2 + 1) / 2$$

For a size 3x3, the minimum constant is 15, for 4x4 it is 34, for 5x5 it is 65, 6x6 it is 111, then 175, 260, ...

Any lower sum will force the use of either negative numbers or fractions (not whole numbers) to solve the magic square.

### What is the Franklin Square?

Franklin's square is a panmagic square with a magic constant of 260.

Example:

 52 61 4 13 20 29 36 45 14 3 62 51 46 35 30 19 53 60 5 12 21 28 37 44 11 6 59 54 43 38 27 22 55 58 7 10 23 26 39 42 9 8 57 56 41 40 25 24 50 63 2 15 18 31 34 47 16 1 64 49 48 33 32 17

### What is the Lo-Shu Magic Square?

This is a 3x3 magic square used in Feng Shui which is represented as well

 4Wealth 9Fame 2Relationship 3Family 5Health 7Children 8Wiseness 1Career 6Help/Friends

### What is the KaldorMagic Square?

Kaldor's magic square is a square used in economics, which has nothing to do with digits or numbers of mathematics but rather with concepts from economic policy.

### Is there a Magic Square in 3D (Magic Cube)?

Yes, there are magic cubes, their magic value is $$M = n(n^3+1)/2$$ (which may or may not have magic diagonals)

Example:

 9 17 6 5 21 16 18 4 20
 15 1 26 25 14 3 2 27 13
 8 24 10 12 7 23 22 11 9

## Source code

dCode retains ownership of the online 'Magic Square' tool source code. Except explicit open source licence (indicated CC / Creative Commons / free), any 'Magic Square' algorithm, applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any 'Magic Square' function (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and no data download, script, copy-paste, or API access for 'Magic Square' will be for free, same for offline use on PC, tablet, iPhone or Android ! dCode is free and online.

## Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!