0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

有限体の拡張から有限射影平面とその巡回平面を拵えて魔円陣を求める話の Python 編

Posted at

暫く便利なJuliaで遊んでいた魔円陣の探索をPythonでも実装してみました。

 先ずは結果を披露しましょう。ただし, 大きさが100以下の魔円陣です。大抵の場合解が大量なので, ソートをかけた最初の3つと最後の3つだけの紹介となっています。魔円陣というよりは(巡回)完全差集合の性質から, 1つ見つかると全ての解は簡単な作業で求まりますから, 本当は1個ずつの紹介でも良かったのかもしれません。


 以下では, MC は Magic Circle を意味します。元になる有限体の標数を$p$, 位数は$p^n$, 魔円陣の大きさ(MC Size), 魔円陣の総和(Sum of MC), 解の数(number of MCs)としています。

Magic Circles (MCs) List

p = 2 , n = 1 , p^n = 2 , MC Size = 3 , Sum of MC = 7 : number of MCs = 1
[1,2,4]

p = 3 , n = 1 , p^n = 3 , MC Size = 4 , Sum of MC = 13 : number of MCs = 2
[1,2,6,4]
[1,3,2,7]

p = 2 , n = 2 , p^n = 4 , MC Size = 5 , Sum of MC = 21 : number of MCs = 1
[1,3,10,2,5]

MC Size 6 以降のデータ(左端の▶︎をクリックすれと展開します)

p = 5 , n = 1 , p^n = 5 , MC Size = 6 , Sum of MC = 31 : number of MCs = 5
[1,2,5,4,6,13]
[1,2,7,4,12,5]
[1,3,2,7,8,10]
[1,3,6,2,5,14]
[1,7,3,2,4,14]

p = 7 , n = 1 , p^n = 7 , MC Size = 8 , Sum of MC = 57 : number of MCs = 6
[1,2,10,19,4,7,9,5]
[1,3,5,11,2,12,17,6]
[1,3,8,2,16,7,15,5]
[1,4,2,10,18,3,11,8]
[1,4,22,7,3,6,2,12]
[1,6,12,4,21,3,2,8]

p = 2 , n = 3 , p^n = 8 , MC Size = 9 , Sum of MC = 73 : number of MCs = 4
[1,2,4,8,16,5,18,9,10]
[1,4,7,6,3,28,2,8,14]
[1,6,4,24,13,3,2,12,8]
[1,11,8,6,4,3,2,22,16]

p = 3 , n = 2 , p^n = 9 , MC Size = 10 , Sum of MC = 91 : number of MCs = 6
[1,2,6,18,22,7,5,16,4,10]
[1,3,9,11,6,8,2,5,28,18]
[1,4,2,20,8,9,23,10,3,11]
[1,4,3,10,2,9,14,16,6,26]
[1,5,4,13,3,8,7,12,2,36]
[1,6,9,11,29,4,8,2,3,18]

p = 11 , n = 1 , p^n = 11 , MC Size = 12 , Sum of MC = 133 : number of MCs = 18
[1,2,9,8,14,4,43,7,6,10,5,24]
[1,2,12,31,25,4,9,10,7,11,16,5]
[1,2,14,4,37,7,8,27,5,6,13,9]
: : : : (omission) : : : :
[1,14,10,20,7,6,3,2,17,4,8,41]
[1,15,5,3,25,2,7,4,6,12,14,39]
[1,22,14,20,5,13,8,3,4,2,10,31]

p = 13 , n = 1 , p^n = 13 , MC Size = 14 , Sum of MC = 183 : number of MCs = 20
[1,2,13,7,5,14,34,6,4,33,18,17,21,8]
[1,2,21,17,11,5,9,4,26,6,47,15,12,7]
[1,2,28,14,5,6,9,12,48,18,4,13,16,7]
: : : : (omission) : : : :
[1,10,22,34,27,12,3,4,2,14,24,5,8,17]
[1,10,48,9,19,4,8,6,7,17,3,2,34,15]
[1,12,48,6,2,38,3,22,7,10,11,5,4,14]

p = 2 , n = 4 , p^n = 16 , MC Size = 17 , Sum of MC = 273 : number of MCs = 6
[1,2,4,8,16,32,27,26,11,9,45,13,10,29,5,17,18]
[1,3,12,10,31,7,27,2,6,5,19,20,62,14,9,28,17]
[1,7,3,15,33,5,24,68,2,14,6,17,4,9,19,12,34]
[1,7,12,44,25,41,9,17,4,6,22,33,13,2,3,11,23]
[1,7,31,2,11,3,9,36,17,4,22,6,18,72,5,10,19]
[1,21,11,50,39,13,6,4,14,16,25,26,3,2,7,8,27]

p = 17 , n = 1 , p^n = 17 , MC Size = 18 , Sum of MC = 307 : number of MCs = 51
[1,2,18,4,6,37,9,14,79,7,8,11,16,13,32,12,5,33]
[1,2,20,6,12,47,15,30,27,21,4,39,7,10,34,19,5,8]
[1,2,24,15,4,16,12,25,38,50,14,17,5,8,10,11,49,6]
: : : : (omission) : : : :
[1,27,3,13,2,6,50,5,9,11,12,10,7,19,41,53,4,34]
[1,37,11,24,26,16,29,23,18,33,6,8,13,4,3,2,10,43]
[1,39,18,4,6,76,15,11,9,3,31,2,14,5,8,17,7,41]

p = 19 , n = 1 , p^n = 19 , MC Size = 20 , Sum of MC = 381 : number of MCs = 42
[1,2,9,5,48,10,19,23,7,8,13,18,4,33,71,26,6,34,20,24]
[1,2,10,15,23,14,17,4,18,8,33,56,11,5,24,20,46,32,36,6]
[1,2,40,6,14,47,5,7,9,8,10,77,31,33,11,26,4,15,13,22]
: : : : (omission) : : : :
[1,28,11,23,8,36,16,9,57,7,72,12,2,4,15,5,17,10,3,45]
[1,28,50,23,13,6,2,3,9,18,16,15,22,4,55,7,10,35,25,39]
[1,66,9,8,33,2,3,18,7,19,13,29,11,34,14,6,4,12,15,77]

p = 23 , n = 1 , p^n = 23 , MC Size = 24 , Sum of MC = 553 : number of MCs = 78
[1,2,10,28,20,24,5,4,21,22,64,6,31,8,11,7,16,46,59,36,35,32,51,14]
[1,2,11,17,29,4,45,37,5,34,80,21,27,8,16,20,18,79,6,19,7,15,43,9]
[1,2,14,19,6,22,29,38,18,12,32,11,10,5,8,37,9,40,87,48,4,20,7,74]
: : : : (omission) : : : :
[1,36,23,3,25,112,5,8,19,21,44,14,15,2,7,11,34,12,4,6,33,47,30,41]
[1,46,28,26,33,11,20,19,21,52,4,51,7,3,2,13,9,8,6,43,29,16,37,68]
[1,56,10,50,8,28,6,7,5,15,2,9,21,53,23,14,25,45,3,16,24,51,4,77]

p = 5 , n = 2 , p^n = 25 , MC Size = 26 , Sum of MC = 651 : number of MCs = 30
[1,2,30,12,13,22,28,6,5,10,38,14,26,64,8,19,4,20,17,29,36,18,76,9,7,137]
[1,2,40,21,9,19,69,8,6,39,37,17,41,87,25,32,18,29,5,10,12,4,7,13,35,65]
[1,3,11,55,19,33,10,17,12,81,90,13,8,28,35,2,22,18,38,26,32,44,7,16,25,5]
: : : : (omission) : : : :
[1,28,8,46,5,6,27,105,2,16,24,21,50,20,15,102,22,12,13,30,9,10,4,3,41,31]
[1,32,50,21,6,14,39,22,15,3,46,2,7,56,4,25,13,30,44,10,16,8,11,12,5,159]
[1,33,27,12,26,14,16,15,10,37,53,17,4,28,35,13,6,3,2,18,46,50,8,36,7,134]

p = 3 , n = 3 , p^n = 27 , MC Size = 28 , Sum of MC = 757 : number of MCs = 42
[1,2,6,18,16,38,48,44,47,23,67,77,17,5,36,10,11,4,35,14,59,30,33,12,7,13,56,28]
[1,2,6,18,41,13,112,11,5,14,20,32,47,22,23,75,51,12,64,10,33,15,25,17,4,49,7,28]
[1,2,6,18,54,67,19,44,32,65,47,30,13,39,7,16,41,4,49,21,48,10,25,15,51,5,17,11]
: : : : (omission) : : : :
[1,36,57,11,29,13,5,4,21,35,14,3,7,99,2,137,6,20,8,33,55,32,16,23,15,12,19,44]
[1,40,28,5,13,19,23,6,14,2,8,71,12,9,17,104,11,25,27,4,3,44,76,49,35,15,39,57]
[1,53,26,15,21,34,18,32,6,19,8,16,44,4,10,3,119,5,7,28,2,9,20,47,22,23,63,102]

p = 29 , n = 1 , p^n = 29 , MC Size = 30 , Sum of MC = 871 : number of MCs = 132
[1,2,9,10,31,23,5,40,82,16,49,18,25,4,32,26,8,85,74,55,39,17,46,14,24,6,7,20,15,88]
[1,2,10,5,49,70,57,14,9,27,11,44,7,33,8,117,53,60,30,16,26,39,4,25,6,28,24,21,56,19]
[1,2,19,20,13,88,10,14,11,45,4,12,18,65,27,37,29,7,8,38,5,62,127,71,6,17,9,31,28,47]
: : : : (omission) : : : :
[1,57,45,38,30,2,9,25,50,10,5,7,17,4,16,3,48,91,26,27,8,46,76,6,74,18,13,42,14,63]
[1,58,32,4,15,16,6,20,3,11,13,39,48,2,28,46,9,112,7,10,8,54,43,38,68,12,21,44,5,98]
[1,59,6,61,19,36,14,35,40,13,4,7,87,3,34,45,28,5,25,16,2,8,12,9,23,39,81,27,15,117]

p = 31 , n = 1 , p^n = 31 , MC Size = 32 , Sum of MC = 993 : number of MCs = 110
[1,2,10,88,26,27,15,35,6,16,9,24,30,8,20,39,78,40,4,17,43,32,14,5,18,11,36,95,7,45,119,73]
[1,2,14,55,5,26,27,22,13,57,28,12,24,32,50,51,10,29,4,11,19,18,47,42,168,25,20,21,38,8,108,6]
[1,2,19,15,20,12,74,88,26,46,5,39,4,7,91,9,71,67,25,13,40,79,29,16,42,17,6,8,10,52,33,27]
: : : : (omission) : : : :
[1,51,107,69,11,26,50,61,24,40,9,21,38,4,2,54,23,18,25,104,20,16,12,5,14,8,7,71,10,3,32,57]
[1,59,41,10,24,20,50,18,38,31,2,47,35,32,5,6,3,12,4,23,13,77,99,8,65,76,7,22,57,17,28,63]
[1,89,48,12,7,4,103,69,16,6,52,46,26,5,34,8,9,24,3,18,14,29,20,37,13,66,87,15,10,28,2,92]

p = 2 , n = 5 , p^n = 32 , MC Size = 33 , Sum of MC = 1057 : number of MCs = 30
[1,2,4,8,16,23,9,46,18,11,81,36,22,21,40,10,91,13,59,17,27,42,80,20,5,52,38,87,26,19,66,33,34]
[1,2,4,8,16,32,64,23,22,36,42,5,46,25,19,72,84,10,17,75,11,18,21,38,101,43,9,80,26,40,13,20,34]
[1,4,13,3,25,27,12,31,60,9,14,35,30,29,15,22,11,124,38,75,76,51,2,8,26,6,50,7,47,24,62,19,101]
: : : : (omission) : : : :
[1,43,12,26,32,10,65,8,92,94,4,46,47,2,23,36,18,9,24,15,30,7,53,11,3,17,89,22,6,13,16,5,178]
[1,44,92,27,28,65,2,3,74,11,23,30,82,14,35,37,17,15,41,7,36,16,24,18,8,12,9,4,6,148,22,46,60]
[1,49,7,74,4,47,62,33,54,28,37,2,71,27,14,55,48,24,12,6,3,8,5,10,20,40,19,61,38,25,66,31,76]

p = 37 , n = 1 , p^n = 37 , MC Size = 38 , Sum of MC = 1407 : number of MCs = 132
[1,2,16,25,54,52,89,24,23,82,17,63,119,8,40,45,33,37,13,61,59,5,26,20,7,15,34,28,4,6,29,36,21,91,9,60,142,11]
[1,2,17,22,21,15,8,68,24,14,13,94,157,7,18,29,102,31,28,80,40,48,5,11,34,90,6,73,26,4,57,10,46,9,116,12,37,32]
[1,2,22,7,50,17,109,105,97,43,26,8,70,64,28,60,27,6,40,45,10,11,42,5,4,14,38,89,48,35,19,30,41,39,20,16,107,12]
: : : : (omission) : : : :
[1,74,77,15,128,60,26,29,24,8,22,18,114,44,120,14,7,43,6,3,116,34,51,12,5,28,65,2,11,25,46,23,19,16,4,27,10,80]
[1,80,46,8,30,83,9,40,12,56,123,102,26,24,7,16,13,5,10,4,63,43,33,2,69,3,22,20,17,53,66,21,6,58,39,98,11,88]
[1,133,18,36,24,16,56,11,15,111,28,92,61,9,20,3,10,35,112,12,73,2,4,37,14,44,5,17,8,39,50,21,31,7,27,19,62,144]

p = 41 , n = 1 , p^n = 41 , MC Size = 42 , Sum of MC = 1723 : number of MCs = 287
[1,2,5,110,43,10,30,51,18,68,59,89,6,41,11,22,45,4,21,73,14,97,24,64,36,253,27,38,28,9,26,50,29,17,44,16,56,48,84,23,19,12]
[1,2,12,54,75,84,25,17,34,5,65,96,9,64,94,181,10,27,26,48,62,35,6,44,8,30,60,32,57,23,22,55,31,133,43,16,13,7,4,67,28,18]
[1,2,13,56,94,28,23,45,47,85,4,39,9,31,19,8,73,24,33,101,18,93,6,54,113,7,22,125,189,10,20,14,21,11,38,25,12,5,36,82,26,61]
: : : : (omission) : : : :
[1,119,123,55,33,62,27,79,8,12,32,4,69,110,24,10,19,22,9,14,26,21,16,30,35,68,96,17,59,42,38,66,25,3,15,39,58,72,6,5,2,152]
[1,122,23,37,131,88,42,3,68,2,34,72,8,20,19,44,11,7,17,14,12,15,151,67,10,22,89,6,48,5,16,9,57,90,13,51,46,40,52,4,29,128]
[1,144,20,15,33,22,37,30,11,54,17,6,28,45,2,44,84,56,80,26,5,9,18,76,7,114,3,36,13,8,4,38,24,69,16,97,104,86,43,10,19,169]

p = 43 , n = 1 , p^n = 43 , MC Size = 44 , Sum of MC = 1893 : number of MCs = 210
[1,2,7,44,70,22,18,6,58,49,133,38,14,19,26,15,27,239,94,62,21,34,118,16,4,28,29,8,72,39,11,25,31,84,43,23,63,13,89,73,30,5,12,78]
[1,2,11,18,17,36,104,16,4,63,9,70,23,52,22,25,15,96,5,7,213,57,24,26,8,69,121,28,10,68,27,33,6,59,54,197,37,19,61,30,21,43,45,41]
[1,2,20,7,6,47,45,17,25,34,74,67,43,14,72,51,69,15,64,39,46,66,4,61,12,16,24,114,71,102,50,56,55,49,26,81,58,32,5,63,94,78,10,8]
: : : : (omission) : : : :
[1,88,53,26,119,10,64,12,9,6,13,16,55,25,22,20,50,8,3,46,5,72,63,148,33,32,4,37,2,163,60,45,68,30,18,34,87,23,133,14,17,7,59,93]
[1,89,26,49,30,18,11,5,9,41,37,39,7,8,4,23,135,45,40,13,57,86,10,51,127,3,44,24,36,2,31,32,120,67,21,56,186,6,22,52,20,82,17,111]
[1,94,47,31,35,24,2,32,134,196,25,108,23,20,37,30,42,3,8,38,27,9,62,17,111,51,5,7,6,15,86,16,52,29,19,22,55,126,39,50,10,4,40,105]

p = 47 , n = 1 , p^n = 47 , MC Size = 48 , Sum of MC = 2257 : number of MCs = 360
[1,2,7,12,4,41,115,78,15,29,30,49,46,55,34,13,14,69,11,20,17,73,219,50,170,56,42,28,76,5,38,39,36,24,68,85,35,18,33,54,52,6,91,124,8,32,71,62]
[1,2,11,21,8,88,30,6,12,45,89,59,7,53,109,65,9,16,31,50,17,27,76,37,62,23,15,49,5,41,127,24,58,22,4,51,28,33,68,10,204,52,19,20,229,102,70,72]
[1,2,13,101,155,35,85,19,47,20,5,59,10,18,37,53,40,4,39,36,125,8,70,76,105,135,98,29,52,51,62,34,48,41,22,121,21,24,9,17,6,157,30,31,7,42,46,11]
: : : : (omission) : : : :
[1,113,61,57,2,20,11,40,84,3,60,18,5,45,76,35,34,134,54,37,4,8,13,67,97,85,19,29,10,7,9,27,66,6,24,14,56,42,64,181,15,32,75,77,28,89,52,171]
[1,121,59,2,95,31,103,9,42,34,70,14,26,22,67,38,25,68,7,39,19,77,6,23,78,10,80,33,24,3,209,74,5,13,17,15,21,16,4,8,108,43,11,44,149,72,47,175]
[1,130,6,13,30,7,3,51,15,2,94,87,133,24,118,36,156,20,12,45,89,82,46,63,44,48,52,29,9,22,4,58,21,18,16,86,65,8,25,42,5,23,124,11,74,14,27,169]

p = 7 , n = 2 , p^n = 49 , MC Size = 50 , Sum of MC = 2451 : number of MCs = 126
[1,2,22,4,43,138,19,15,86,8,37,30,59,32,31,96,137,23,13,41,10,6,42,20,144,5,44,81,17,90,33,100,50,55,11,118,61,12,40,314,46,38,18,9,76,7,14,39,35,79]
[1,2,31,13,45,69,153,70,23,41,107,49,16,19,24,39,15,22,40,10,101,165,36,88,18,38,30,109,149,17,112,52,28,53,102,66,8,67,4,51,6,42,83,7,5,9,11,85,94,26]
[1,2,31,102,32,61,39,13,37,23,84,116,40,51,6,42,80,30,81,15,5,24,59,78,9,8,47,7,4,10,53,56,108,94,86,41,49,16,12,70,22,306,18,25,172,27,19,26,79,35]
: : : : (omission) : : : :
[1,95,62,159,178,37,17,7,19,47,82,140,70,14,9,35,76,86,46,28,13,64,126,45,5,94,8,67,22,3,31,57,79,59,60,49,16,39,78,20,10,2,36,4,11,18,85,21,6,115]
[1,120,25,75,23,13,117,46,49,66,69,22,94,38,18,9,12,71,112,97,99,42,60,7,57,16,28,6,20,4,29,2,17,125,14,68,8,3,40,45,41,63,84,155,10,5,32,81,62,151]
[1,130,6,10,210,28,76,46,26,23,22,38,58,42,19,21,30,4,33,17,3,12,24,129,29,114,47,68,11,2,64,9,5,97,164,25,27,135,63,35,8,113,59,31,94,7,41,44,18,133]

p = 53 , n = 1 , p^n = 53 , MC Size = 54 , Sum of MC = 2863 : number of MCs = 408
[1,2,12,21,4,83,11,30,13,228,6,112,42,19,38,10,49,121,69,9,7,58,5,66,80,20,27,17,28,23,88,29,113,81,8,76,26,182,60,175,22,53,50,32,24,196,101,46,31,55,18,34,62,90]
[1,2,13,4,39,42,12,71,174,27,21,46,133,9,77,118,8,25,78,6,38,22,127,5,26,14,76,130,41,87,61,34,62,18,249,51,28,74,63,115,30,7,82,47,10,186,11,24,29,70,36,32,23,49]
[1,2,15,23,108,33,21,123,32,129,13,48,76,34,35,44,9,47,28,31,11,49,195,67,25,12,14,29,7,45,120,64,4,153,30,73,77,6,57,204,10,168,90,127,46,19,20,58,8,16,109,5,22,71]
: : : : (omission) : : : :
[1,114,100,18,17,72,71,31,51,39,60,127,2,10,46,9,14,5,38,4,33,3,13,92,131,20,44,29,113,77,11,52,104,54,8,68,41,95,101,134,50,87,85,26,22,98,27,7,25,123,15,6,24,216]
[1,123,7,154,88,72,90,13,95,21,98,52,39,133,2,3,14,18,62,142,36,15,9,29,4,22,41,8,69,23,25,59,27,83,237,30,43,66,12,28,6,10,58,85,47,54,82,45,20,11,50,87,70,145]
[1,215,9,38,34,10,15,12,50,17,16,19,117,36,69,140,8,22,26,74,49,115,66,14,28,4,53,75,3,55,18,43,64,20,142,40,5,6,90,2,63,23,70,41,13,113,24,7,221,21,39,29,146,233]

p = 59 , n = 1 , p^n = 59 , MC Size = 60 , Sum of MC = 3541 : number of MCs = 590
[1,2,5,34,11,22,124,54,101,57,165,25,12,49,10,48,32,38,100,85,31,79,105,17,9,78,16,46,14,6,77,29,15,21,19,95,18,51,30,93,175,221,63,73,35,98,109,28,89,13,43,91,182,23,24,64,4,125,27,230]
[1,2,7,15,8,5,40,19,118,85,159,4,63,66,36,81,71,54,116,93,56,26,16,237,135,147,20,134,14,65,43,18,31,27,47,41,70,50,12,48,52,39,197,21,86,69,73,11,46,44,55,95,29,80,34,17,121,6,83,103]
[1,2,12,61,58,10,72,45,71,66,28,41,138,93,156,18,70,32,49,11,31,9,39,7,50,98,44,30,33,47,5,106,78,6,29,8,175,25,87,16,217,64,109,13,54,114,204,59,65,36,17,108,62,27,56,21,209,126,4,19]
: : : : (omission) : : : :
[1,161,34,105,29,51,292,82,26,37,62,103,32,47,45,75,23,148,12,90,38,176,41,40,36,20,4,18,71,2,15,157,31,21,152,27,153,58,28,101,25,30,14,43,7,3,111,104,46,8,5,6,66,61,9,39,35,33,16,236]
[1,187,9,22,45,2,53,41,29,51,82,46,248,32,12,16,38,114,115,4,52,143,10,73,6,59,99,210,26,61,3,11,306,36,81,68,40,116,50,7,17,71,15,34,63,39,33,58,27,8,13,92,19,18,5,20,84,77,30,214]
[1,211,3,144,92,27,55,84,4,83,23,70,24,5,68,150,32,31,17,52,108,21,22,164,121,16,138,15,19,7,38,2,9,67,36,6,107,135,57,77,28,25,102,13,33,58,37,61,35,30,20,39,12,60,14,238,8,10,44,333]

p = 61 , n = 1 , p^n = 61 , MC Size = 62 , Sum of MC = 3783 : number of MCs = 384
[1,2,13,7,110,152,72,63,26,34,31,109,35,163,101,17,11,214,170,10,61,122,126,30,12,38,158,64,108,6,96,86,25,8,36,46,49,92,24,103,9,48,19,37,21,176,5,73,70,51,106,220,29,18,27,14,40,39,4,62,32,52]
[1,2,15,127,47,52,77,96,203,78,13,42,73,36,72,160,28,124,62,4,101,107,54,9,35,25,292,40,11,59,33,34,45,140,97,148,48,20,12,26,121,74,14,158,43,75,7,50,154,53,31,10,61,29,56,37,27,19,30,65,16,5]
[1,2,19,34,60,101,37,6,71,83,69,12,38,11,122,17,108,54,158,68,67,31,42,105,44,14,26,103,145,111,9,16,23,18,33,95,148,242,28,36,70,87,13,76,4,75,117,15,175,240,59,45,20,27,5,30,91,46,72,24,78,7]
: : : : (omission) : : : :
[1,169,10,76,164,68,7,41,15,253,38,144,21,43,46,28,30,20,5,4,73,23,90,158,101,118,39,52,122,49,71,32,33,27,54,13,72,12,22,2,126,66,69,26,16,19,18,62,8,134,3,44,109,31,14,98,93,224,40,11,6,220]
[1,169,26,272,61,100,59,90,45,142,36,6,21,4,10,33,79,213,87,16,22,92,7,8,133,23,17,243,138,34,55,9,11,65,51,66,29,44,13,5,53,48,12,37,83,94,2,28,52,166,19,50,54,39,72,56,32,46,24,81,3,197]
[1,191,6,51,4,74,65,86,15,62,96,13,93,83,81,47,5,27,18,49,9,64,43,16,25,182,11,20,17,63,121,112,2,10,23,7,14,71,34,26,136,180,89,153,237,39,29,66,3,19,53,38,104,46,24,120,102,28,8,82,87,203]

p = 2 , n = 6 , p^n = 64 , MC Size = 65 , Sum of MC = 4161 : number of MCs = 72
[1,2,4,8,16,32,64,128,29,22,50,42,26,87,58,44,100,37,47,52,174,93,23,88,159,41,74,49,45,9,95,61,86,196,5,33,142,11,25,21,13,163,183,135,82,27,78,43,98,19,71,18,17,173,122,39,80,53,167,40,110,20,55,10,66]
[1,2,4,8,16,32,64,128,165,80,11,211,119,39,108,13,22,197,166,38,21,93,74,10,61,29,49,216,17,9,44,33,210,40,111,79,54,116,83,19,57,37,5,45,141,43,105,20,95,27,58,51,47,25,92,110,68,36,46,55,34,18,23,65,66]
[1,3,12,22,21,5,88,84,20,70,95,146,27,14,9,133,117,77,80,31,127,75,47,83,2,6,11,13,44,42,10,35,134,7,71,97,40,79,61,51,72,67,39,108,56,36,53,54,28,18,266,113,121,105,49,160,33,29,181,73,25,125,94,101,65]
: : : : (omission) : : : :
[1,112,56,28,14,7,130,26,97,52,29,128,37,69,16,19,11,20,27,41,160,55,74,87,51,32,38,5,17,40,54,79,3,9,36,144,131,110,148,109,65,13,89,64,53,8,15,10,34,80,108,63,95,6,18,72,249,39,103,4,155,220,71,2,223]
[1,124,39,28,33,107,30,127,23,93,22,4,53,24,40,226,153,51,105,62,50,132,58,11,2,248,78,31,25,66,29,185,60,254,9,18,19,17,38,34,76,21,44,3,5,106,41,7,35,45,43,6,10,212,82,14,70,15,75,86,12,20,113,102,209]
[1,194,198,3,6,12,11,13,22,26,44,52,88,19,20,65,176,38,25,15,47,56,27,55,120,98,8,66,5,76,50,30,43,51,17,95,54,110,7,114,119,97,99,16,132,10,152,31,28,41,60,49,4,33,102,34,133,57,108,220,14,75,2,151,237]

p = 67 , n = 1 , p^n = 67 , MC Size = 68 , Sum of MC = 4557 : number of MCs = 420
[1,2,9,40,96,68,13,91,63,8,85,199,75,121,44,55,183,84,4,22,28,33,158,32,101,179,23,198,36,24,92,58,186,39,6,118,19,18,72,113,47,29,35,141,73,120,170,127,30,102,79,7,67,15,16,25,21,57,294,5,38,10,17,42,66,14,20,94]
[1,2,26,5,20,112,42,131,149,21,44,99,87,10,74,12,6,85,4,117,23,40,79,27,16,14,68,32,58,62,7,66,75,221,37,8,38,70,156,19,36,289,60,243,49,80,71,17,22,13,59,56,11,93,41,64,192,61,77,78,124,113,109,9,15,218,147,47]
[1,2,30,46,48,143,297,160,81,25,12,47,53,4,65,17,11,38,202,43,13,21,51,24,5,35,23,45,22,95,39,164,7,9,142,26,167,6,14,99,129,61,10,50,42,31,148,153,74,182,70,41,105,15,155,83,8,19,147,89,55,52,88,145,44,18,36,175]
: : : : (omission) : : : :
[1,154,64,43,97,130,65,83,33,19,16,10,14,163,170,55,17,39,87,110,31,48,46,4,84,25,360,142,102,6,23,186,2,166,63,60,85,89,67,8,28,54,22,171,13,160,70,57,12,30,7,44,121,80,11,9,38,15,71,34,27,5,96,18,3,74,41,279]
[1,181,92,69,14,100,4,22,98,71,56,67,21,2,40,66,93,86,11,76,15,65,73,70,207,29,48,165,193,34,101,262,31,43,68,47,13,132,133,95,103,28,5,3,9,7,30,200,18,150,152,10,41,38,20,55,6,44,72,35,27,32,53,25,39,57,84,220]
[1,183,39,29,41,20,32,8,75,92,12,160,147,89,18,27,51,62,24,84,36,76,5,33,4,63,165,21,77,54,25,298,74,13,15,57,31,3,19,178,2,9,35,97,14,16,64,59,10,55,71,174,66,82,121,7,209,58,283,48,166,47,95,50,6,17,26,229]

p = 71 , n = 1 , p^n = 71 , MC Size = 72 , Sum of MC = 5113 : number of MCs = 852
[1,2,5,130,15,160,76,12,34,86,68,65,28,148,47,19,31,58,113,99,17,42,20,94,30,23,49,162,128,141,125,106,75,105,64,55,74,354,71,25,13,14,84,6,101,103,36,115,69,41,54,92,48,39,4,285,37,26,18,82,277,131,149,16,57,10,51,9,112,45,11,21]
[1,2,7,53,305,31,220,16,92,111,80,33,32,22,14,52,58,177,105,21,115,48,38,26,25,46,35,12,72,23,100,134,40,34,42,129,18,49,8,91,77,61,56,158,39,43,78,20,249,15,79,215,13,4,169,6,324,139,161,83,73,29,41,44,11,151,59,45,5,19,103,27]
[1,2,9,30,77,206,5,84,98,43,8,27,144,72,368,156,83,227,36,74,54,10,181,4,92,65,37,48,55,57,88,7,16,147,20,106,109,21,28,52,24,99,66,13,18,32,169,137,25,69,45,90,82,40,153,6,62,19,34,33,38,22,91,29,46,302,47,108,136,73,44,14]
: : : : (omission) : : : :
[1,192,15,71,19,23,16,174,5,51,17,114,70,89,43,14,24,115,27,226,7,84,25,11,100,145,69,37,306,112,6,40,108,141,50,28,133,44,243,165,60,75,94,29,168,20,47,30,2,61,3,85,13,9,12,53,102,45,10,49,33,117,125,224,48,4,31,41,54,8,18,283]
[1,210,43,138,243,2,21,114,20,45,18,115,101,15,36,22,47,143,24,26,40,59,64,28,91,9,4,72,147,6,48,96,25,275,62,109,53,142,12,30,19,68,7,3,29,5,33,41,185,159,93,95,11,16,55,31,257,17,35,46,84,57,89,14,158,8,80,60,110,209,56,227]
[1,221,156,10,6,12,9,265,255,91,17,82,35,19,175,51,13,133,62,115,22,98,42,47,85,59,7,69,4,112,49,81,20,23,45,34,109,39,48,58,83,75,44,8,53,33,63,11,3,90,38,449,2,111,170,36,31,92,55,5,24,41,30,26,223,46,32,25,15,114,50,256]

p = 73 , n = 1 , p^n = 73 , MC Size = 74 , Sum of MC = 5403 : number of MCs = 600
[1,2,15,110,7,55,93,74,41,39,136,149,27,9,83,87,26,5,68,23,66,11,24,22,6,165,33,224,30,12,8,40,121,112,38,65,137,16,59,19,10,43,141,54,105,303,32,13,34,51,279,84,49,102,140,4,116,44,14,56,25,61,21,76,69,37,143,64,276,191,67,71,262,108]
[1,2,20,16,15,9,4,115,197,7,161,17,25,76,8,114,69,37,6,80,113,49,10,135,30,5,47,73,91,55,134,50,11,88,150,139,117,12,34,107,102,65,136,71,144,100,87,90,68,89,14,83,27,78,33,140,92,56,48,26,95,142,131,45,32,296,70,257,98,29,79,58,75,18]
[1,2,30,148,74,34,134,4,54,13,11,57,144,93,38,48,190,9,154,20,97,16,64,23,62,37,65,128,14,127,150,25,19,12,28,92,161,104,49,6,45,60,10,88,8,18,43,76,95,17,73,36,47,42,21,474,5,208,15,140,359,52,27,39,77,46,7,22,72,35,210,50,41,308]
: : : : (omission) : : : :
[1,188,73,11,2,157,75,35,29,103,42,48,129,122,8,69,31,106,98,46,87,227,143,83,18,3,162,140,88,24,263,23,70,68,63,89,71,78,33,14,44,16,20,166,51,41,25,147,82,118,79,136,6,4,30,15,7,5,38,59,17,9,28,179,32,116,39,81,53,19,96,210,121,194]
[1,194,94,217,77,59,75,4,42,81,74,51,14,17,18,126,60,24,23,44,57,112,72,39,19,29,85,86,34,62,7,140,30,11,264,99,66,27,26,105,32,13,122,6,281,63,43,9,3,25,36,229,92,16,5,33,50,95,15,56,97,212,307,10,132,20,2,68,8,109,40,89,102,318]
[1,224,12,11,131,45,239,41,86,76,84,112,56,118,114,10,22,149,78,72,269,6,29,8,63,77,5,20,33,9,66,24,27,13,17,44,60,109,113,105,2,48,39,178,79,19,221,69,46,49,16,212,26,47,7,14,122,15,302,36,52,3,28,92,18,85,116,70,59,34,4,166,96,255]

p = 79 , n = 1 , p^n = 79 , MC Size = 80 , Sum of MC = 6321 : number of MCs = 588
[1,2,18,48,183,88,12,164,242,38,179,17,29,5,55,41,64,15,65,30,26,14,23,35,99,50,162,54,84,25,57,142,117,111,75,52,276,83,42,7,74,16,43,19,9,85,204,31,146,67,6,4,104,8,145,45,92,32,119,36,107,11,13,102,76,27,260,129,170,33,53,195,148,44,47,141,236,22,39,353]
[1,2,20,241,18,14,58,73,4,11,80,129,24,86,137,150,19,30,12,69,78,96,29,87,221,437,33,109,92,31,21,440,51,106,79,34,6,53,65,38,127,102,89,26,28,43,108,13,50,57,41,154,166,132,44,70,117,35,104,36,76,94,7,126,8,39,17,10,128,55,5,62,238,75,9,16,349,99,37,45]
[1,2,22,10,50,49,23,258,48,119,152,89,37,29,9,45,8,223,26,194,70,30,11,65,71,97,21,166,104,115,117,171,96,186,268,36,20,68,325,51,42,123,14,5,28,116,201,4,13,90,18,74,98,16,39,130,44,129,63,6,58,87,52,7,143,57,191,31,110,105,269,43,95,40,46,15,12,67,81,77]
: : : : (omission) : : : :
[1,191,75,35,10,178,83,58,63,246,98,47,87,5,4,28,24,55,7,19,20,73,53,122,183,60,80,88,132,104,11,43,95,179,3,12,2,68,21,108,189,33,36,94,151,65,260,136,44,22,78,338,25,159,177,160,13,27,127,186,84,29,42,6,51,156,8,23,18,152,38,34,30,67,50,59,76,74,16,217]
[1,225,89,24,159,21,32,161,128,117,75,115,9,63,8,20,64,83,186,41,189,191,109,43,174,240,36,134,86,62,58,37,45,29,40,97,2,5,228,26,33,17,18,38,4,48,13,181,150,51,67,87,44,54,25,6,16,156,88,14,135,27,3,116,105,160,163,222,19,107,15,55,11,12,34,96,133,10,39,297]
[1,234,28,6,55,36,16,47,220,21,156,165,13,116,70,3,11,37,64,357,133,49,41,217,8,120,53,79,32,118,83,26,5,162,143,12,66,92,139,251,30,208,39,85,20,82,4,136,2,56,18,75,60,62,57,77,23,17,10,19,25,245,88,59,45,22,43,38,42,95,35,33,98,108,72,15,9,152,7,525]

p = 3 , n = 4 , p^n = 81 , MC Size = 82 , Sum of MC = 6643 : number of MCs = 216
[1,2,6,18,5,49,15,55,48,44,45,165,4,52,75,13,17,115,74,61,40,28,71,130,226,12,122,34,218,7,39,51,14,188,143,38,159,25,10,63,43,67,120,84,37,123,53,47,177,59,107,19,60,76,57,180,11,217,58,36,77,239,50,16,86,149,33,347,125,21,117,41,112,42,20,108,209,22,205,265,164,82]
[1,2,6,18,17,37,51,16,31,64,153,48,93,192,14,15,359,33,38,25,119,76,196,7,100,237,165,4,70,42,45,188,5,282,171,115,191,125,59,40,114,13,10,52,68,140,60,89,19,34,39,30,106,22,28,155,49,323,11,21,65,101,79,55,118,94,57,102,117,90,20,36,77,61,124,66,84,160,12,46,164,82]
[1,2,6,18,31,23,93,4,65,92,11,176,12,29,66,100,79,197,17,16,94,7,104,211,42,70,36,77,10,136,62,28,272,139,76,22,131,39,105,14,61,241,51,13,35,25,257,21,128,63,89,32,220,43,189,181,52,15,19,40,56,154,108,37,194,30,137,129,122,20,186,84,155,5,138,204,150,46,68,50,38,44]
: : : : (omission) : : : :
[1,202,267,2,18,66,49,43,4,58,82,8,13,29,11,393,75,167,89,45,35,30,14,245,15,108,5,36,57,73,38,81,23,3,74,114,59,184,69,9,97,125,116,138,72,16,101,76,157,6,22,32,67,131,25,112,10,129,12,19,37,27,91,200,46,24,39,87,33,52,94,212,102,34,17,397,216,48,7,225,71,227]
[1,252,43,88,16,18,7,44,125,30,27,38,26,22,14,40,21,132,28,24,294,29,90,81,56,53,5,78,66,42,120,50,13,47,32,187,130,84,49,6,17,82,12,265,138,20,73,215,46,31,87,59,211,175,68,67,101,11,148,15,234,128,70,10,9,107,8,98,103,151,150,2,33,4,141,96,203,45,239,3,71,389]
[1,288,96,32,16,59,14,69,35,42,11,45,120,31,105,4,122,33,92,43,52,174,18,90,26,65,28,13,21,180,101,2,10,17,20,163,166,99,139,25,57,15,40,129,156,115,9,61,143,19,5,170,54,270,78,22,173,38,46,39,63,86,66,365,23,131,114,58,6,30,44,7,60,50,189,179,3,68,8,198,292,297]

p = 83 , n = 1 , p^n = 83 , MC Size = 84 , Sum of MC = 6973 : number of MCs = 1098
[1,2,7,142,63,53,153,11,18,12,77,91,84,55,20,405,125,48,37,60,22,21,45,254,54,32,273,251,46,49,109,90,8,115,229,34,87,69,35,208,31,47,5,166,26,398,81,76,44,58,42,17,79,93,94,40,28,33,122,38,143,133,99,25,211,224,105,27,110,4,131,15,24,130,72,36,92,19,184,50,56,6,51,13]
[1,2,14,67,151,9,6,31,93,53,19,61,70,505,45,87,49,149,121,59,79,55,161,44,24,199,89,20,142,179,96,23,190,145,103,10,65,52,92,78,95,204,27,5,30,207,152,88,126,86,34,101,73,12,82,8,104,201,159,4,21,26,277,41,28,187,200,38,77,22,11,43,64,7,29,128,97,91,182,13,50,48,18,39]
[1,2,15,9,40,244,53,16,54,6,28,47,10,82,96,12,295,50,51,79,42,48,155,31,72,8,14,21,93,126,32,5,137,33,213,106,7,52,46,19,68,44,56,84,134,13,325,181,149,153,30,77,45,238,102,89,73,120,39,23,86,41,78,210,144,20,38,118,61,36,63,11,132,116,141,55,83,71,95,315,343,25,4,194]
: : : : (omission) : : : :
[1,266,68,241,253,23,130,9,7,21,65,48,78,193,40,2,434,45,173,13,75,114,58,22,81,46,76,33,10,17,35,4,8,61,278,117,3,31,36,87,51,6,26,116,82,15,91,223,71,124,77,19,85,111,131,14,98,54,200,118,59,100,63,29,72,84,53,41,38,11,259,25,5,110,18,129,50,55,121,89,160,24,20,344]
[1,339,63,64,114,310,73,100,12,6,14,79,212,42,88,248,44,107,49,28,59,33,2,23,135,82,27,30,80,51,182,50,54,95,128,40,147,29,74,123,133,70,15,11,5,124,24,19,3,38,7,258,214,65,10,71,166,209,13,39,105,8,108,34,143,53,68,86,141,61,36,62,4,17,55,134,47,9,69,37,89,192,90,394]
[1,345,68,100,63,120,34,23,16,51,31,50,10,127,64,48,186,11,27,5,103,144,58,145,19,28,71,139,232,29,12,97,87,323,94,17,25,77,15,9,56,13,72,44,130,45,61,22,198,35,79,52,156,33,37,151,2,53,21,86,18,36,113,122,30,230,84,49,26,14,6,248,105,318,110,59,3,4,200,88,8,115,147,390]

p = 89 , n = 1 , p^n = 89 , MC Size = 90 , Sum of MC = 8011 : number of MCs = 1335
[1,2,7,35,240,321,106,84,99,62,120,46,72,6,230,80,13,53,115,30,107,4,21,109,385,248,63,138,50,224,23,87,26,60,260,20,34,69,335,58,39,52,56,18,14,29,96,176,40,239,24,65,178,325,94,27,101,76,55,104,129,154,95,47,148,81,119,73,102,51,100,5,11,17,31,143,12,158,36,144,19,22,49,8,114,38,37,135,15,67]
[1,2,12,31,61,50,224,70,35,21,18,9,218,95,23,110,65,28,34,38,22,54,86,80,84,5,112,66,373,197,195,78,225,7,170,4,143,135,71,63,87,58,193,125,160,173,19,97,16,103,17,32,139,41,11,79,6,109,129,257,315,67,8,138,64,155,30,121,207,184,20,13,44,25,161,29,24,158,130,42,59,40,68,55,26,10,37,51,311,253]
[1,2,14,24,276,264,133,5,136,60,86,143,6,189,95,63,184,101,209,52,125,15,132,116,78,29,20,115,102,137,167,7,99,18,58,36,119,303,171,256,71,91,79,9,65,44,13,35,363,46,8,148,51,246,25,72,62,27,178,100,28,59,34,200,214,55,11,45,262,50,19,4,81,84,39,22,53,30,37,10,21,12,70,26,64,126,42,183,32,219]
: : : : (omission) : : : :
[1,263,7,21,15,25,5,19,14,177,221,8,48,83,86,3,145,22,32,165,47,23,44,46,4,137,20,101,11,69,71,76,26,74,35,27,268,126,58,120,119,111,16,2,75,53,115,232,218,95,13,125,57,223,42,116,34,110,39,166,9,171,79,55,29,59,65,557,52,103,51,31,41,118,194,6,81,17,105,91,97,10,142,37,96,60,224,12,174,541]
[1,300,142,183,239,15,43,7,86,102,117,286,116,64,62,37,181,23,30,27,76,35,49,75,97,34,26,14,41,639,73,85,114,4,2,148,42,265,61,8,44,95,28,107,20,19,48,22,140,178,144,5,78,101,112,54,119,24,66,79,106,153,11,36,129,72,10,88,12,214,17,21,25,31,121,9,59,134,91,132,96,29,3,13,92,373,71,33,18,380]
[1,334,59,32,38,121,48,46,43,81,19,65,6,12,160,3,30,75,2,9,104,5,24,188,52,73,62,174,8,39,10,300,305,14,21,45,31,20,128,82,150,92,74,123,241,7,99,58,158,194,63,192,112,55,145,56,147,126,4,22,151,141,184,25,136,68,134,64,15,275,36,132,17,37,13,28,44,16,146,374,23,153,98,140,40,53,34,27,42,378]

p = 97 , n = 1 , p^n = 97 , MC Size = 98 , Sum of MC = 9507 : number of MCs = 1056
[1,2,11,185,69,29,12,148,114,499,94,7,33,177,36,23,342,270,144,39,116,45,20,138,363,21,102,6,28,90,9,96,249,52,31,4,145,206,80,27,239,182,25,70,304,81,30,62,17,171,5,38,583,26,117,281,47,175,37,48,19,74,63,88,91,22,56,76,55,147,61,167,44,10,120,197,152,146,16,8,60,82,77,184,49,15,42,58,215,103,32,18,71,51,46,66,53,72]
[1,2,11,336,99,17,79,42,39,8,131,90,188,78,46,67,235,71,24,27,5,199,18,36,50,61,58,10,118,7,41,105,219,158,412,159,28,52,189,19,82,25,329,37,115,29,62,170,31,9,26,34,23,20,97,194,134,15,49,148,6,59,526,85,45,145,12,180,4,98,418,44,167,274,33,150,106,30,323,55,53,120,94,16,22,133,109,141,75,182,114,137,70,72,21,63,88,73]
[1,2,28,35,69,197,160,154,59,15,210,14,117,166,40,45,10,238,315,140,38,53,58,110,8,4,288,52,9,11,56,144,108,90,48,88,79,120,114,151,34,37,41,285,440,269,6,159,264,307,43,80,7,22,84,281,49,44,103,36,62,57,18,82,25,161,256,223,27,97,19,13,60,102,68,47,94,5,46,50,83,70,121,21,105,177,64,86,77,304,127,42,39,240,17,16,148,23]
: : : : (omission) : : : :
[1,328,46,150,80,142,36,147,124,14,41,120,131,89,136,288,56,81,527,43,181,65,109,100,4,107,59,35,28,164,50,21,52,117,126,68,88,42,30,343,60,53,32,112,40,208,218,75,118,54,163,105,66,31,17,45,377,13,38,148,146,57,110,33,6,96,119,319,12,10,27,128,61,15,3,5,11,58,9,20,70,185,25,91,188,44,64,195,154,82,47,133,7,125,2,24,115,369]
[1,355,196,96,10,241,25,97,111,101,216,134,128,13,18,225,4,335,57,24,44,19,114,323,117,65,5,108,32,3,56,27,80,22,52,294,136,16,362,33,43,17,30,41,211,37,153,64,98,62,89,120,12,42,40,45,138,9,46,29,324,69,137,290,53,39,205,146,15,34,2,119,48,61,6,104,20,180,157,50,28,38,189,26,73,95,8,142,23,77,58,14,7,105,175,11,246,512]
[1,359,394,68,37,296,49,55,232,13,67,26,35,198,36,45,172,39,235,89,32,136,3,381,38,84,53,7,11,219,9,115,140,82,41,161,34,91,20,42,251,59,101,6,96,108,221,5,72,87,25,8,15,190,78,277,99,50,98,76,133,14,44,74,176,215,116,22,24,19,100,51,103,31,16,79,88,75,227,220,131,57,52,4,17,69,83,27,70,178,28,2,10,54,63,29,85,654]

Python によるプログラム

 そんなに複雑でもないのですが, 幾つかの部分に分かれます。少しずつ見ていきましょう。先ずはライブラリは何を使っているかです。生成多項式やそれの元になる?既約多項式などは, 列挙ではなく「当たって」る(つまり行き当たりばったりに条件に合うものを探している)ので乱数が必要です。行列の計算なども利用するので numpysympy も。itertools は何かの列挙に使ったのだけど...最終的に必要だったかどうか...

FiniteProjectivePlane.py
import random,sympy,itertools
from sympy import isprime
import numpy as np

 続きです。先ずは, 素数の累乗の列挙powerofprimesList(s,n)から。$s$以上$n$以下の素数及び素数の累乗で表される数の組のリストを返します。

Pythonのプログラムです(左端の▶︎をクリックすれと展開します)
FiniteProjectivePlane.py
# =======================================================================================================
def powerofprimesList(s,n):# 素数の累乗の列挙 : s から n まで。
    lst=[]
    for q in range(s,n+1):
        if isprime(q):
            lst.append(np.array([q,1]))
        else:
#        print(q)
            p=2
            while p<q:
                k=2
                while p**k<=q:
                    if p**k==q:
                        lst.append(np.array([p,k]))
                        break
                    else:
                        k=k+1
                if p**k==q:
                    break
                p=p+1
                while isprime(p)==False:
                    p=p+1
    return lst
# =======================================================================================================
def listofListprint(lst):
    lststr=[]
    ls=len(lst[0])
    for e in lst:
        estr=""
        lsl=[]
        for i in range(ls):
            lsl.append(str(e[i]))
        lststr.append("["+",".join(lsl)+"]")
    print(",".join(lststr))
# =======================================================================================================

 例えば, 次のようにすれば,

FiniteProjectivePlane.py
pplst=powerofprimesList(1,50)
listofListprint(pplst)

[2,1],[3,1],[2,2],[5,1],[7,1],[2,3],[3,2],[11,1],[13,1],[2,4],[17,1],[19,1],[23,1],[5,2],[3,3],[29,1],[31,1],[2,5],[37,1],[41,1],[43,1],[47,1],[7,2]

と表示されます。[2,1] は$2^1$ を [7,2]は $7^2$ を表す配列です。つまり, $s=1$ 以上 $n=50$ 以下の素数と素数の累乗が順に列挙されているリストを返すプログラムです。
 これは, シンプルな素数を位数とする場合は, 有限体の設定もその3次拡大による有限射影平面の構築も簡単なのですが, 素数の累乗を位数とする場合は少々面倒なことをしているので, 場合分けが必要となるからです。

 次は少し長いプログラムです。
 PickIrreduciblePolynomial(p,n)は$GF(p)$上の$n$次の既約多項式を1つ見繕うものです。$GF(p^n)$に拡大する場合に必要になるのですが, ここでは3次拡大なので, $n=3$としておけば良かったのかも。
 inAryAry(a,lst)は... pythonに慣れてないので, 配列の配列に, 「ある配列が含まれているかどうか」が, numpy を用いているからか, in では上手く判断できてない感じだったので, わざわざ拵えたものです。
 OnePrimitivePolynomial(p,n)は生成多項式を1つ返す... ではなくて生成多項式を一つ求めてそれによって生成される拡大体の元の配列を返すプログラムです。PickIrreduciblePolynomial(p,n)で返ってきた既約多項式の根が生成元となっている(つまり例えば根を$\alpha$としたときに, $\alpha$の累乗が拡大体を生成するかどうかをチェック)とその多項式は生成多項式なのでそれを返す...のではなくて, その生成多項式(の根)が生成する拡大体$GF(p^n)$の元の配列を返します。

Pythonのプログラムです(左端の▶︎をクリックすれと展開します)
FiniteProjectivePlane.py
def PickIrreduciblePolynomial(p,n):# GF(p)上のn次の既約多項式を既約多項式を1つ見繕う
    chk=False
    while chk==False:
        irrl=[1]
        for i in range(n):
            if i==n-1:
                irrl.append(random.randrange(p-1)+1)
            else:
                irrl.append(random.randrange(p))
#        print("checking :",irrl,len(irrl),p)
        chkA=True# 代入チェックのためのフラグ, チェックA
        vlst=[]
        for x in range(p):# GF(p)の元0,...,p-1のどれを代入しても0にならない事
            v=(x**n)%p
            vl=[v]
            for r in range(1,len(irrl)):
                v=(v+irrl[r]*(x**(n-r)))%p
                vl.append(v)
#        print(x,":",v)
#            print(vl)
            vlst=vlst+[v]
            if v==0:# 0になったらチェックAを偽にしてループを抜ける
                chkA=False
                break
#        print(','.join(map(str,vlst)))
        if chkA:
            chk=True# チェックをクリアすればOK
    return irrl
# ========================================================================================================

def inAryAry(a,lst):# ある配列aが配列の配列lstに含まれているかどうか」
    ans=False
    for e in lst:
        if all(a==e):
#        if a==e:
            ans=True
            break
    return ans
# ========================================================================================================
def OnePrimitivePolynomial(p,n):#生成多項式を一つ求めてそれによって生成される拡大体の元の配列を返す
    chk=False
    while chk==False:
        irrl=PickIrreduciblePolynomial(p,n)# 既約多項式を1つ
        Alp=np.zeros((n,n),int)# Numpy の零行列を用意して
        for i in range(n-1):# 1にするところと
            Alp[i,i+1]=1
        for i in range(n):# 既約多項式で決まるところを設定
            Alp[i,0]=(p-irrl[i+1])%p
#        print(Alp)
        e=np.zeros(n,int)# 零ベクトルでない最初の元を
        e[n-1]=1# (0,0,0,...,1)とする。
        GFpnll=[e]# それをGF(p^n)の最初の元とする
        chkGFpn=[]# これはスカラー倍チェック用のリスト
        for k in range(1,p):
            chkGFpn.append(k*e%p)# こんな風に元のスカラー倍を入れておく
        chk=False# チェック用フラグ
        while chk==False:
#        print(GFpnll)
            e=(Alp@e)%p# Alp*eで次の元を
#    print(e,chkGFpn)
            if inAryAry(e,chkGFpn):# 既に現れれた元(か, そのスカラー倍)であれば, 
#                print(">> ",e)
                break# ループを抜ける
            else:
                for k in range(1,p):# そうでない新規の元なら
#            print(k*e%p)
                    chkGFpn.append(k*e%p)# スカラー倍をチェック用
                GFpnll.append(e)# 元を加えておく
        if len(GFpnll)==(p**n-1)//(p-1):# ループを抜けたときに数が満たされていれば
            chk=True# フラグをOKにする
    return GFpnll

 次は完全差集合や魔円陣の具体化のルーチン。
 makeCyclicDifferenceSetFromFiniteProjectivePlaneList(GFpnll,p,n)は, 拡大体GFpnllの元を順に見て, 巡回平面で$z=0$となるものを番号で拾い出してその配列を返します。これが完全差集合になっているというわけです。
 makeMagicCircleFromCyclicDifferenceSet(cds)は, そうやって得た完全差集合から魔円陣を拵えます。単純に隣接項の差を取るだけです。
 MagicCircleCheck(bbl)は, 魔円陣がちゃんと「魔円陣」になっているかどうか。つまり, 隣接項の和が$1$から順に揃っているかどうかをチェックします。
 MakeMagicCircle(p)は, ここまでのルーチンの総まとめです。位数が素数の$p$の有限体の3次拡大でできる有限射影平面から拵える魔円陣を返します。

Pythonのプログラムです(左端の▶︎をクリックすれと展開します)
FiniteProjectivePlane.py
# ========================================================================================================
def makeCyclicDifferenceSetFromFiniteProjectivePlaneList(GFpnll,p,n):
    cds=[]
    for i in range(len(GFpnll)):
        e=GFpnll[i]
        if e[2]==0:
            cds.append(i-1)
    cds.append((p**n-1)//(p-1))
    return cds
# ========================================================================================================
def makeMagicCircleFromCyclicDifferenceSet(cds):
    bbl=[]
    for i in range(len(cds)-1):
        bbl.append(cds[i+1]-cds[i])
#    print(bbl)
    return bbl
# ========================================================================================================
def MagicCircleCheck(bbl):
    bbll=bbl+bbl
    bbls=[]
    for i in range(len(bbl)):
        for j in range(1,len(bbl)):
            bbls.append(sum(bbll[i:i+j]))
    bbls.append(sum(bbl))
    bblss=sorted(bbls)
    endp=len(bblss)-1
    if bblss[endp]==len(bblss):
        return True
    else:
        return False
def MakeMagicCircle(p):
    n,chk=3,False
    while chk==False:
        GFpnll=OnePrimitivePolynomial(p,n)
        print(len(GFpnll),(p**n-1)//(p-1))
        cds=makeCyclicDifferenceSetFromFiniteProjectivePlaneList(GFpnll,p,n)
        print(cds)
        bbl=makeMagicCircleFromCyclicDifferenceSet(cds)
        if MagicCircleCheck(bbl):
            chk=True
    return bbl

 これで, 単純でシンプルな位数が素数な有限体$GF(p)$を$3$次拡大した有限射影平面の巡回平面から拵える分はお見せできました。
 でもまだ残りがあります。位数が素数の累乗である$GF(p^n)$を$3$次拡大する場合です。

OnePrimitivePolynomialAll(p,n)は$n$次の生成多項式と拡大体である$GF(p^n)$の元の配列を返します。
MakeAlpMatrix(p,n,irrl)はその生成多項式から計算の為の根$\alpha$の計算に使う行列$Alp$を拵えるルーチンです。
AlpMulS(p,n,Alp,a,an,b,bn)は$a\cdot\alpha^{an}\times b\cdot\alpha^{bn}$の計算を返します。
AlpMul(p,n,Alp,al,bl)は$\alpha$の$n$次式で表される$GF(p^n)$の元同士の積を係数の配列$al,bl$から計算して, 結果の$n$次多項式の係数配列を返します。
PickIrreduciblePolynomialThird(p,n)は...ややこしいですが, この$GF(p^n)$を更に3次拡大するための既約多項式をピックアップするものです。有限体を3次拡大した有限射影平面とその巡回平面が必要ですから。
OnePrimitivePolynomialThird(p,n)はその既約多項式のうち生成多項式になるものをピックアップするもの。
makeCyclicDifferenceSetFromFiniteProjectivePlaneListThird(p,n)はそうやってできた生成多項式から有限者絵平面を構成して完全差集合を作るという...

Pythonのプログラムです(左端の▶︎をクリックすれと展開します)
FiniteProjectivePlane.py
def OnePrimitivePolynomialAll(p,n):
    chk=False
    while chk==False:
        irrl=PickIrreduciblePolynomial(p,n)
        Alp=np.zeros((n,n),int)
        for i in range(n-1):
            Alp[i,i+1]=1
        for i in range(n):
            Alp[i,0]=(p-irrl[i+1])%p
#        print(Alp)
        e=np.zeros(n,int)
        e[n-1]=1
        be=e
        GFpnll=[e]
        chkGFpn=[e]
        chk=False
        while chk==False:
#        print(GFpnll)
            e=(Alp@e)%p
#    print(e,chkGFpn)
            if all(e==be):#inAryAry(e,chkGFpn):
#                print(">> ",e)
                break
            else:
#                for k in range(1,p):
#            print(k*e%p)
#                    chkGFpn.append(k*e%p)
                GFpnll.append(e)
        if len(GFpnll)==p**n-1:
            chk=True
    return [irrl,GFpnll]
# ========================================================================================================
def MakeAlpMatrix(p,n,irrl):
#    p=len(irrl)
    Alp=np.zeros((n,n),int)
    for i in range(n-1):
        Alp[i,i+1]=1
    for i in range(n):
        Alp[i,0]=(p-irrl[i+1])%p
    return Alp
def AlpMulS(p,n,Alp,a,an,b,bn):
    k=(a*b)%p
#    print(k)
    tn=an+bn
    ae=np.zeros(n,int)
    ae[n-1]=1
    for i in range(tn):
        ae=Alp@ae
    ae=k*ae
    return np.array([x%p for x in ae])
def AlpMul(p,n,Alp,al,bl):
    ans=np.zeros(n,int)
    for an in range(n):
        for bn in range(n):
            ans=ans+AlpMulS(p,n,Alp,al[n-an-1],an,bl[n-bn-1],bn)
    return np.array([x%p for x in ans])
def PickIrreduciblePolynomialThird(p,n):
    ans=OnePrimitivePolynomialAll(p,n)
    GFpn,irrl=ans[1],ans[0]
    Alp=MakeAlpMatrix(p,n,irrl)
    GFpnp=GFpn+[np.zeros(n,int)]
    ln=len(GFpnp)
#    print(GFpn)
    chk=False
    while chk==False:
        e=np.zeros(n,int)
        e[n-1]=1
        irrl=[e]
        for i in range(3):
            if i==3-1:
                irrl.append(GFpnp[random.randrange(ln-1)])
            else:
                irrl.append(GFpnp[random.randrange(ln)])
        chkA=True
#        print("*** ",irrl)
        eo=np.zeros(n,int)
        for e in GFpn:
            val=AlpMul(p,n,Alp,e,AlpMul(p,n,Alp,e,e))
            for i in range(1,3):
                val=val+AlpMul(p,n,Alp,irrl[i],AlpMul(p,n,Alp,e,e))
            if all(val==eo):
                chkA=False
                break
        if chkA:
            chk=True
    return [Alp,np.array(irrl)]
def OnePrimitivePolynomialThird(p,n):
    chk=False
    while chk==False:
        ans=PickIrreduciblePolynomialThird(p,n)
        Alp,irrl=ans[0],ans[1]
        ze=np.zeros(3,int)
#        Omg=[np.array([0,0,0]),np.array([0,0,0]),np.array([0,0,0])]
#        Omg=[Omg,Omg,Omg]
#        print(Omg[1][1])        
#        for i in range(1-1):
#            Omg[i][i+1]=np,array([0,0,1])
#        for i in range(n):
#            tmp=[p,p,p]-irrl[i+1]
#            Omg[i][0]=np.array([x%p for x in tmp])
        OmgA=np.array([x%p for x in ([p]*n-irrl[1])])
        OmgB=np.array([x%p for x in ([p]*n-irrl[2])])
        OmgC=np.array([x%p for x in ([p]*n-irrl[3])])
#        print(irrl)
#        print(OmgA,OmgB,OmgC)
        e=np.zeros(n,int)
        eo=e.copy()
        eo[n-1]=1
        ev=[e,e,eo]
        GFpnll=[ev]
        chkGFpn=[]
        chk=False
        while chk==False:
#            print(" >   ",ev)
#        print(GFpnll)
            ev=[AlpMul(p,n,Alp,OmgA,ev[0])+ev[1],AlpMul(p,n,Alp,OmgB,ev[0])+ev[2],AlpMul(p,n,Alp,OmgC,ev[0])]
            ev=np.array([[y%p for y in x] for x in ev])
            evf=np.array(list(itertools.chain.from_iterable(ev)))
#            print(" >>> ",ev[0],ev[1],ev[2])
#    print(e,chkGFpn)
            if inAryAry(evf,chkGFpn):
#                print(">> ",e)
                break
            else:
                for k in range(1,p):
                    kev=np.array([[k*y%p for y in x] for x in ev])
                    kevf=np.array(list(itertools.chain.from_iterable(kev)))
                    #            print(k*e%p)
                    chkGFpn.append(kevf)
                GFpnll.append(ev)
        if len(GFpnll)>=((p**n)**3-1)//((p**n)-1):
            chk=True
    return GFpnll
def makeCyclicDifferenceSetFromFiniteProjectivePlaneListThird(p,n):
    GFpnll=OnePrimitivePolynomialThird(p,n)
    cds=[]
    for i in range((p**n)**2+(p**n)+1):
        if all(GFpnll[i][2]==np.array([0]*n)):
            cds.append(i-1)
    cds.append((p**n)**2+(p**n)+1)
    return cds

でこれらのプログラムやらルーチンやらを纏めて, となる。
FullMakeMagicCircle(p,m)は素数と素数の累乗を配列で返してくれる**powerofprimesList(s,n)**に対して, 標数$p$とその$m$次拡大な体を基本として得られる魔円陣を$m=1$の場合とそれ以外の場合で場合分けしてまとめたもの。
 そして, 一つ完全差集合が得られたら, そこから全ての解を列挙して, そうして得られた魔円陣をソートして配列で返してくれる。
tmpPrnBbls(bbls)はそうした魔円陣の配列の配列を表示する為のどうでも良いルーチン。

Pythonのプログラムです(左端の▶︎をクリックすれと展開します)
FiniteProjectivePlane.py
def FullMakeMagicCircle(p,m):
    q=p**m
    if m==1:
        n,chk=3,False
        while chk==False:
            GFpnll=OnePrimitivePolynomial(p,n)
#        print(len(GFpnll),(p**n-1)//(p-1))
            cds=makeCyclicDifferenceSetFromFiniteProjectivePlaneList(GFpnll,p,n)
            bbl=makeMagicCircleFromCyclicDifferenceSet(cds)
            if MagicCircleCheck(bbl):
                chk=True
        bbl=makeMagicCircleFromCyclicDifferenceSet(cds)
    else:
        chk=False
        while chk==False:
            cds=makeCyclicDifferenceSetFromFiniteProjectivePlaneListThird(p,m)
            bbl=makeMagicCircleFromCyclicDifferenceSet(cds)
            if MagicCircleCheck(bbl):
                chk=True
        bbl=makeMagicCircleFromCyclicDifferenceSet(cds)
    if bbl[1]>bbl[q]:
#        print(" || ",bbl)
        bbla=bbl[0]
        bbl=bbl[1:q+1]
#        print(" >> ",bbl)
        bbl.reverse()
#        print(" >> ",bbl)
        bbl=[bbla]+bbl
#    print(bbl)
    bbls=[bbl]
#        bbl.insert(0,bbla)
#    print(cds,">",bbl)
    for i in range(2,q**2+q+1):
        nthcds=[(x*i)%(q**2+q+1) for x in cds]
        nthcdsS=sorted(list(set(nthcds)))
        nthcdsS.append(q**2+q+1)
        bbl=makeMagicCircleFromCyclicDifferenceSet(nthcdsS)
#        print(" || ",bbl)
        if 1 in bbl:
            while bbl[0]!=1:
                bbl=bbl[1:] + bbl[:1]
#                print(" ** ",bbl)
            if bbl[1]>bbl[q]:
                bbla=bbl[0]
#            print(">",bbl)
                bbl=bbl[1:q+1]
#            print(">",bbl)
                bbl.reverse()
                bbl=[bbla]+bbl
#            print(">",bbl)
#        print(nthcds,nthcdsS,">",bbl)
            if bbl not in bbls:
                bbls.append(bbl)
    return bbls
# ============================================================================
def tmpPrnBbls(bbls):
    bblss=sorted(bbls)
    if len(bblss)<=6:
        for bbl in bblss:
            bblstr=map(str,bbl)
            print("["+",".join(bblstr)+"]")
    else:
        for bbl in bblss[0:3]:
            bblstr=map(str,bbl)
            print("["+",".join(bblstr)+"]")
        l=len(bblss)
        print(" - - - - (omission) - - - -")
        for bbl in bblss[l-3:l]:
            bblstr=map(str,bbl)
            print("["+",".join(bblstr)+"]")

 数学的な仕組みというか構造というか論拠は全く説明してませんが, これで大体の事は分かる筈。Juliaで組んだ話も投げてあると思うので多少は参考になるかと。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?