1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
// Bring's Surface generator
// Copyright (C) 2018 Zeno Rogue, see 'hyper.cpp' for details
#include <stdio.h>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
using namespace std;
int isize(const auto x) { return x.size(); }
int mul(int a, int b) {
int p = 0;
for(int i=0; i<3; i++) if((a>>i)&1)
for(int j=0; j<3; j++) if((b>>j)&1)
p ^= (1<<(i+j));
for(int z=4; z>=0; z--)
if(p&(8<<z)) p ^= (11<<z);
return p;
}
int elements = 0;
vector<array<int, 5>> s5_elements;
map<array<int, 5>, int> back;
int multable[504][504];
int mpow(int a, int n) {
int z = a;
while(n > 1) z = multable[a][z], n--;
return z;
}
int inset[504];
int main() {
array<int, 5> ar;
for(int i=0; i<5; i++) ar[i] = i;
do {
back[ar] = isize(s5_elements);
s5_elements.push_back(ar);
}
while(next_permutation(ar.begin(), ar.end()));
for(int a=0; a<120; a++)
for(int b=0; b<120; b++) {
array<int, 5> res;
for(int i=0; i<5; i++)
res[i] = s5_elements[a] [ s5_elements[b][i] ];
multable[a][b] = back[res];
}
int id;
for(int a=0; a<120; a++)
if(multable[a][a] == a) id = a;
printf("id = %d\n", id);
int xid = 0;
int sols = 0;
for(int R=0; R<120; R++)
for(int P=0; P<120; P++) {
if(P == 0 && mpow(R, 5) == id) printf("deg5 R\n");
if(multable[P][P] != id) continue;
if(mpow(multable[R][P], 4) != id) continue;
if(mpow(R, 5) != id) continue;
xid++;
vector<int> allels = {id};
inset[id] = xid;
for(int i=0; i<isize(allels); i++) {
for(int m: {P, R}) {
int im = allels[i];
int a = multable[im][m];
// printf("%d x %d = %d\n", im, m, a);
if(inset[a] != xid) inset[a] = xid, allels.push_back(a);
}
}
if(isize(allels) != 120) continue;
printf("R = %d P = %d count = %d\n", R, P, isize(allels));
for(int a: s5_elements[R]) printf("%d ", a); printf("// ");
for(int a: s5_elements[P]) printf("%d ", a); printf("\n");
sols++;
array<int, 120> cellid;
array<int, 120> bycellid;
for(int a=0; a<120; a++) cellid[a] = 0;
int ncell = 0;
for(int a=0; a<120; a++) if(cellid[a] == 0) {
int b = a;
for(int s=0; s<5; s++) cellid[b] = ncell + s, bycellid[ncell + s] = b, b = multable[b][R];
ncell += 5;
}
printf("ncell = %d\n", ncell);
for(int a=0; a<24; a++) {
printf("/* %03d */ ", a);
for(int b=0; b<5; b++) {
printf("%d, ", cellid[multable[bycellid[5*a+b]][P]]);
}
printf("\n");
}
return 0;
}
printf("solutions = %d\n", sols);
return 0;
}
|