Tool to generate magic squares. A magic square of size N is a matrix composed of distinct integers between 1 and N^2 set such as the sum of any line or column are equal.

dCode is free and its tools are a valuable help in games, puzzles and problems to solve every day! You have a problem, an idea for a project, a specific need and dCode can not (yet) help you? You need custom development? Contact-me!

Tool to generate magic squares. A magic square of size N is a matrix composed of distinct integers between 1 and N^2 set such as the sum of any line or column are equal.

Answers to Questions

How to create a magic square of odd order?

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, go to the other side of the matrix.

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

4 Wealth

9 Fame

2 Relationship

3 Family

5 Health

7 Children

8 Wiseness

1 Career

6 Help/Friends

Ask a new question

Source code

dCode retains ownership of the source code of the script Magic Square. Except explicit open source licence (indicated Creative Commons / free), any algorithm, applet, snippet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in any informatic langauge (PHP, Java, C#, Python, Javascript, etc.) which dCode owns rights can be transferred after sales quote. So if you need to download the Magic Square script for offline use, for you, your company or association, see you on contact page !

dCode uses cookies to customize the site content, analyze user behavior and adapt dCode to your use. Some data is stored and collected for advertising purposes and may be shared with our partners. OK