www.zhghf.net

   
中国幻方世界
平方幻方专题

 首  页

平方幻方历史
 
平方数幻方
 
4、5阶平方幻方
 
6阶平方幻方
 
7阶平方幻方
 
8阶平方幻方
 
9阶平方幻方
 
10阶平方幻方
 
11阶平方幻方
 
12阶平方幻方
 
13阶平方幻方
 
14阶平方幻方
 
15阶平方幻方
 
16阶平方幻方
 
18阶平方幻方
 
20阶平方幻方
 
 

 

幻方协会
E-mail:gy1397@163.com

 

  

10阶平方幻方   

    

8阶平方幻方、9阶平方幻方我们可以说有大量的作品了,其构造方法也是多种多样的。可是10阶、11阶、12阶平方幻方……存在吗,多少年来,幻方专家们甚至不敢踏入它们的大门。电脑的发展给人们的发明创造插上了翅膀,芬兰boAkademi大学有一位出生于1982年叫 Fredrik Jansson的学生,虽然他只是读大二学习物理,但他也学习数学和计算机科学。20041月,他看到法国高次幻方网站后,首先对10阶平方数组进行了研究,他找到了24,643,236种数组,然后进行编程设计,这大约花了一个星期时间,然后在自己的型号为 Athlon 2800的计算机上运行,计算时间不到24小时,10阶平方幻方(图16),就在年轻的大学生面前诞生了。随后他又用同样的方法获得了11阶平方幻方。在中国,汕头大学的陈沐天利用计算机,也构造了一个11阶平方幻方(图17),这个幻方具有一种很美的对称性。其实,12阶三次幻方(图18)早在 2002年由德国的 Walter Trump先生构造成功,他的方法是有开创性的,因而给Fredrik Jansson 有许多启发。由于12阶三次幻方本身是平方幻方,所以我们不再那样迫切探索12阶平方幻方了。

10阶平方幻方研究的故事
Text written by Fredrik Jansson, in February 2004.


I got many of these ideas from Christian Boyer's www.multimagie.com web site, and Walter Trump's story of the 12th-order trimagic square. Thank you!

I first listed all bimagic series of order 10, and wrote them to a file. I found 24,643,236 series. This is also the number which was reported on the multimagic series page of www.multimagie.com.

A series is represented by a 128 bit number, where bit n is set if the series contains the number n. The 10 rows of a magic square can not have any number in common, this is quickly checked with the boolean AND function. A set of 10 independent rows are searched for by backtracking. When 10 independent rows are found, the program tries to find a set of 10 columns, such that every column has exactly one number common with every row, and no column has any number in common with an other column. This is done by first searching for all series that has exatly one bit in common with every chosen row, and then trying to construct a set of 10 independent columns from these. This too is done by a backtracking search. A quick test to see if two numbers have more than one bit in common is: a AND (a-1) is zero if a has at most one bit set, because subtracting 1 changes the least-significant set bit to 0, but leaves every other set bit unchanged.

If a set of 10 independent columns is found, an at least semi-bimagic square can be constructed from the chosen rows and columns. A diagonal must have one number in common with every row, and one number in common with every column. The series in the list of possible columns already have one number in common with every row, so the program searches throught these to find all that have one number in common with every chosen column. The two diagonals must have no numbers in common in an even-order square, so every pair of possible diagonals are tested. If they have no bits in common, these could possibly be the diagonals in our square.

There is one additional requirement that almost made me loose hope about finding the square: if row 1 contains the numbers a and b, column 1 contains a and c, column 2 contains b and d,  a and d lies on one diagonal, and b and c on the other, then c and d must be on the same row.

a

..

b

..

..

..

c

..

d

So when we have chosen the first element on diagonal 1, there is only one row that contains this element, so this must be the first row. There is also only one column that contains this element, so this must be the first column. The first row has exactly one element in common with the second diagonal, this element must be the last element in the first row. This also fixes the position of the column containing that element, it will be the last column. The last column has one element in common with the first diagonal, this element must be in the lower right corner d. The first column has one element in common with the second diagonal, this must be in the lower left corner c. If elements c and d are on different rows, nothing can be done besides using an other pair of diagonals.

The same check must also be done for the second and second-to-last elements of the diagonals, and so on.

I think the key ideas in my program is to use bit-strings to represent the series, and not to consider the order of the rows and columns, or the order of the elements in the rows and columns. This makes the search space considerably smaller.

When the program found the solution, it just printed the rows, columns and diagonals used, and I assembled the square by hand.

The program was written in C. I had plans to optimize the most timecritical part (searching for a set of 10 columns with no bits in common) with assembler-language, possibly using SSE-instructions that can do calculations on a 128-bit number at once, but the solution was found before I got that done. This project took about a week to program, and the square was found in less than 24h of computing on my Athlon 2800.

Fredrik Jansson, Turku, January 2004

 


1896年由G. Pfeffermann,用非连续数字构造的10阶平方幻方

24

133

108

51

129

19

71

42

13

100

130

28

35

134

72

52

14

111

94

20

1

7

84

113

106

40

37

64

117

121

107

65

2

18

23

99

128

122

85

41

83

112

116

29

15

135

95

6

36

63

75

102

132

43

3

123

109

22

26

55

97

53

16

10

39

115

120

136

73

31

17

21

74

101

98

32

25

54

131

137

118

44

27

124

86

66

4

103

110

8

38

125

96

67

119

9

87

30

5

114

 

2

19

70

1

66

74

73

60

68

72

58

77

15

3

65

4

67

69

71

76

62

63

82

75

61

59

79

6

5

13

49

18

14

78

98

40

25

96

43

44

94

41

27

42

35

91

21

95

37

22

93

39

23

38

31

90

33

30

29

99

34

100

36

83

45

24

26

28

97

32

8

85

64

57

7

56

80

48

16

84

54

11

86

47

87

12

92

20

50

46

51

52

88

81

10

55

9

53

89

17

16