"""Exact check of the splitting table in Section 7 (complex exponents): behaviour of 2 and 3 in Q(sqrt(-d)).""" from sympy import jacobi_symbol, factorint def disc(d): # discriminant of Q(sqrt(-d)), d squarefree positive return -d if (-d) % 4 == 1 else -4 * d def behaviour(p, D): if D % p == 0: return "ramified" if p == 2: return "split" if D % 8 == 1 else "inert" return "split" if jacobi_symbol(D % p, p) == 1 else "inert" for d in [1, 3, 19, 43, 67, 163, 2, 7, 11, 23, 47]: D = disc(d) b2, b3 = behaviour(2, D), behaviour(3, D) ns = [p for p, b in ((2, b2), (3, b3)) if b != "split"] cls = "(a)" if len(ns) == 2 else "(b)" if len(ns) == 1 else "(c)" print(f"d={d:4d} D={D:5d} 2: {b2:9s} 3: {b3:9s} class {cls}")