素数倒数幻方(prime reciprocal magic square)是指用素数倒数及其倍数的循环小数各位数组成的幻方。有些素数的倒数则可以形成对角线和也满足条件的幻方。
考虑在十进制下的1/7,其小数为循环小数1/7 = 0·142857142857142857...,若再考虑其倍数,会看到这六个数字的循环排列(英语:cyclic permutation):
1/7 = 0·1 4 2 8 5 7...2/7 = 0·2 8 5 7 1 4...3/7 = 0·4 2 8 5 7 1...4/7 = 0·5 7 1 4 2 8...5/7 = 0·7 1 4 2 8 5...6/7 = 0·8 5 7 1 4 2...
若用上述数字形成方阵,每一列的和是1+4+2+8+5+7,即为27,每一行的和也是27,若不考虑对角线,因此可以形成一个幻方:
1 4 2 8 5 72 8 5 7 1 44 2 8 5 7 15 7 1 4 2 87 1 4 2 8 58 5 7 1 4 2
不过其对角线不是27。
考虑1/19的倍数,下一行是上一行的二倍,而小数位数似乎右移一位:
01/19 = 0.052631578,94736842102/19 = 0.1052631578,9473684204/19 = 0.21052631578,947368408/19 = 0.421052631578,94736816/19 = 0.8421052631578,94736
分子乘以2会让小数的位数右移一位:
在1/19形成的方阵中,其最大周期为18,每一行及每一列的和是81,而且对角线也是81,完全符合幻方的条件:
01/19 = 0·0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1...02/19 = 0·1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2...03/19 = 0·1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3...04/19 = 0·2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4...05/19 = 0·2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5...06/19 = 0·3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6...07/19 = 0·3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7...08/19 = 0·4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8...09/19 = 0·4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9...10/19 = 0·5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0...11/19 = 0·5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1...12/19 = 0·6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2...13/19 = 0·6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3...14/19 = 0·7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4...15/19 = 0·7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5...16/19 = 0·8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6...17/19 = 0·8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7...18/19 = 0·9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8...
在各素数在不同进制下,也可能会有相同的现象,以下是列表,列出素数、进制以及幻方和 ((进制-1) 乘 (素数-1) / 2:
Rademacher, H. and Toeplitz, O. The Enjoyment of Mathematics: Selections from Mathematics for the Amateur. Princeton, NJ: Princeton University Press, pp. 158–160, 1957.
Weisstein, Eric W. "Midy's Theorem." From MathWorld—A Wolfram Web Resource. http://mathworld.wolfram.com/MidysTheorem.html