✔ 最佳答案
幻方,有時又稱魔方,由一組排放在正方形中的整數組成,其每行、每列以及兩條對角線上的數之和均相等。通常幻方由從1到N2的連續整數組成,其中N為正方形的行或列的數目。因此N階幻方有N行N列,並且所填充的數字為從1到N2。
幻方可以使用N階方陣來表示,矩陣的每行、每列以及兩條對角線的和都等於常數M2(N),如果填充數為
圖片參考:
http://upload.wikimedia.org/math/2/9/3/293fe678a070641f189afe1b30ed5a3b.png
,那麼有
圖片參考:
http://upload.wikimedia.org/math/c/1/6/c1613b32735074e14013e5c9f1e5550f.png
In recreational mathematics, a magic square of order n is an arrangement of n² numbers, usually distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant. A normal magic square contains the integers from 1 to n². The term "magic square" is also sometimes used to refer to any of various types of word square.
Normal magic squares exist for all orders n ≥ 1 except n = 2, although the case n = 1 is trivial—it consists of a single cell containing the number 1. The smallest nontrivial case, shown below, is of order 3.
圖片參考:
http://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Magicsquareexample.svg/180px-Magicsquareexample.svg.png
The constant sum in every row, column and diagonal is called the magic sum or magic constant, M. The magic constant of a normal magic square depends only on n and has the value
圖片參考:
http://upload.wikimedia.org/math/1/3/6/13652227c2537f1018ce4d011d792db1.png
For normal magic squares of order n = 3, 4, 5, …, the magic constants are:
15, 34, 65, 111, 175, 260, … (sequence A006003 in OEIS)