"""The three roots and the lifted automorphism in the carry algebra at kappa=1.""" import json from math import prod def power_of_x(exponent): """Canonical monomial coefficient and exponent in F_19[X]/(X^9-7).""" quotient, degree = divmod(exponent, 9) return pow(7, quotient, 19), degree def main(): # Y=X^3 has Y^3=7. The base map is Y -> 7Y and its lift is X -> YX. roots = sorted(y for y in range(19) if pow(y, 3, 19) == 7) assert roots == [4, 6, 9] assert prod(roots) % 19 == 7 assert power_of_x(12) == (7, 3) orbit = [power_of_x(4**j) for j in range(10)] assert len(set(orbit[:9])) == 9 and orbit[0] == orbit[9] == (1, 1) assert orbit[3] == (7, 1) and power_of_x(3*4**3) == (1, 3) assert all(pow(y, 9, 19) == 1 and pow(y, 3, 19) != 1 for y in roots) print(json.dumps({"p": 19, "r": 3, "kappa": 1, "roots": roots, "root_product": prod(roots) % 19, "order_of_Y": 9, "lift_order": 9, "third_image_of_X": orbit[3], "third_image_of_Y": power_of_x(3*4**3)}, indent=2)) if __name__ == "__main__": main()