program-example.py

back to table · edit · history · where entries came from · files · download

529 bytes, as of the version from 2026-11-17 11:01 (current). Recorded here, not run.

import numberdb.sage as numberdb
from sage.rings.number_field.number_field import CyclotomicField
from sage.rings.complex_arb import ComplexBallField
# Exact example c = 1 + 3*omega, N(c) = 7.
L = CyclotomicField(21)
z = L.gen(); omega = z**7
# omega reduces to 2 modulo this ideal.
exponent = {1: 0, 2: 1, 4: 2}
G = sum(omega**exponent[pow(x, 2, 7)] * z**(-3*x) for x in range(1, 7))
ComplexBallField(400)(G)
# The attached generate.py computes any eligible (a,b).
# Its default enumerates all eligible ideals with norm <= 500.