# groups.py -- names of the small groups occurring in the paper, from invariants of their multiplication tables; # order 16 via groups16.py (which builds the 14 groups and checks that the invariant separates them), orders 4, 6, 8, 10, 12, 20 # by their element orders, which separate the groups of these orders. from collections import Counter import groups16 NAMES={2:{((1,1),(2,1)):"Z2"},3:{((1,1),(3,2)):"Z3"},5:{((1,1),(5,4)):"Z5"}, 4:{((1,1),(2,1),(4,2)):"Z4",((1,1),(2,3)):"Z2^2"}, 6:{((1,1),(2,1),(3,2),(6,2)):"Z6",((1,1),(2,3),(3,2)):"D3"}, 10:{((1,1),(2,1),(5,4),(10,4)):"Z10",((1,1),(2,5),(5,4)):"D5"}, 8:{((1,1),(2,1),(4,2),(8,4)):"Z8",((1,1),(2,3),(4,4)):"Z4xZ2",((1,1),(2,7)):"Z2^3",((1,1),(2,5),(4,2)):"D4", ((1,1),(2,1),(4,6)):"Q8"}, 12:{((1,1),(2,1),(3,2),(4,2),(6,2),(12,4)):"Z12",((1,1),(2,3),(3,2),(6,6)):"Z6xZ2",((1,1),(2,3),(3,8)):"A4", ((1,1),(2,7),(3,2),(6,2)):"D6",((1,1),(2,1),(3,2),(4,6),(6,2)):"Dic3"}, 20:{((1,1),(2,1),(4,2),(5,4),(10,4),(20,8)):"Z20",((1,1),(2,3),(5,4),(10,12)):"Z10xZ2",((1,1),(2,11),(5,4),(10,4)):"D10", ((1,1),(2,1),(4,10),(5,4),(10,4)):"Dic5",((1,1),(2,5),(4,10),(5,4)):"F20"}} def name_table(mult): """name of the group with multiplication table mult (identity = element 0)""" n=len(mult) if n==16: return groups16.name([tuple(r) for r in mult]) def order(a): k=1;x=a while x!=0: x=mult[a][x]; k+=1 return k return NAMES[n].get(tuple(sorted(Counter(order(a) for a in range(n)).items())),"?")