SPB Git

spb/wp32_uqo

Public
1.5 KB · 32 lines python
1"""Revision check (referee finding F2): for which 11 <= n <= 60 is the layer-swapping map2psi(v_{5j}) = u_j, psi(u_{5j}) = v_j (defined when gcd(n,5) = 1) an automorphism of P(n,5)?3By Frucht-Graver-Watkins (1971) Aut(P(n,k)) is larger than D_n exactly when k^2 = +-1 (mod n)4(plus the seven sporadic small cases, none with k = 5 and n >= 11). Writes results/revision/aut_check.json."""5import json, math, os6ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))78def edges(n, k):9    E = set()10    for i in range(n):11        E.add(frozenset((("u", i), ("u", (i + 1) % n))))12        E.add(frozenset((("u", i), ("v", i))))13        E.add(frozenset((("v", i), ("v", (i + k) % n))))14    return E1516out = []17for n in range(11, 61):18    rec = {"n": n, "k2_mod_n": 25 % n, "k2_is_pm1": (25 % n) in (1, n - 1)}19    if math.gcd(n, 5) == 1:20        inv = pow(5, -1, n)21        E = edges(n, 5)22        psi = lambda x: (("u", (x[1] * inv) % n) if x[0] == "v" else ("v", (x[1] * inv) % n))23        rec["psi_is_automorphism"] = ({frozenset(psi(x) for x in e) for e in E} == E)24    else:25        rec["psi_is_automorphism"] = None  # psi undefined (5 not invertible mod n)26    out.append(rec)27extra = [r["n"] for r in out if r["psi_is_automorphism"]]28print("n with psi an automorphism of P(n,5):", extra)29print("n with 5^2 = +-1 mod n:", [r["n"] for r in out if r["k2_is_pm1"]])30assert extra == [r["n"] for r in out if r["k2_is_pm1"]]31json.dump({"psi_automorphism_n": extra, "rows": out}, open(os.path.join(ROOT, "results", "revision", "aut_check.json"), "w"), indent=1)32
Files · e6146f906a03ada7f5a5c0c2470e50916e0a4100
Menu

Theme