幻方的实现方法研究  被引量:4

Research on Magic Square Method for Programmer

在线阅读下载全文

作  者:李冠林[1] 顾大权[1] 

机构地区:[1]解放军理工大学气象学院,江苏南京211101

出  处:《微型电脑应用》2010年第1期17-18,4,共2页Microcomputer Applications

摘  要:用3种不同的构造法可以生成奇阶、单偶阶和双偶阶三类不同的幻方。以全排列为基础,可以求出全部8个三阶幻方。为了求出全部四阶幻方,先找出1至16中和为34的四个数字组合,共有2064组。该文提出了两个求解全部四阶幻方的算法。算法一先确定一列,再确定4行。算法二先确定两列,再确定4行。四阶幻方共有7040个,其中880个无重复。算法二比算法一效率高得多,表明增加循环之前的检验之后,程序运行的速度大大提高了。Three different methods are used to structure three different kinds of magic squares in this paper: odd order, single-even order and doubly even order. Based on full permutation, All the third-order magic square are found, a total of 8. In order to get all the fourth-order magic square, firstly, identify the group containing 4 elements the sum of which is 34. There are 2064 such groups. This paper provides two algorithms to calculate all the fourth-order magic squares. Algorithm I first determine one column, and then determines the four ranks. Algorithm II first determines two columns, and then determines the four ranks. There are 7040 fourth-order magic squares, in which no-repeat of 880. Algorithm II is far more efficient than Algorithm I, which indicates that the increase of the checks before the cycles contributes to the promotion of the program’s operating speed.

关 键 词:四阶幻方 构造法 全部解 无重复解 

分 类 号:TP301[自动化与计算机技术—计算机系统结构]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象