# SageMath code for working with number field 42.0.124938828493629533000907736270182756286928467256210015044892719712262808512338377882811.1
# Some of these functions may take a long time to execute (this depends on the field).
# Define the number field:
x = polygen(QQ); K. = NumberField(x^42 - 21*x^41 + 231*x^40 - 1750*x^39 + 10395*x^38 - 52269*x^37 + 233611*x^36 - 952918*x^35 + 3599785*x^34 - 12710201*x^33 + 42287014*x^32 - 133370664*x^31 + 400618099*x^30 - 1149584975*x^29 + 3160451592*x^28 - 8341179427*x^27 + 21174580693*x^26 - 51755274760*x^25 + 121953514697*x^24 - 277155797093*x^23 + 608007380806*x^22 - 1287295716241*x^21 + 2631847521996*x^20 - 5192066875520*x^19 + 9886990587068*x^18 - 18146977046303*x^17 + 32112635555588*x^16 - 54655115299659*x^15 + 89504829240548*x^14 - 140479267770793*x^13 + 211514505374151*x^12 - 303526580264439*x^11 + 416119886096880*x^10 - 538840804150264*x^9 + 662937764461147*x^8 - 758558920220686*x^7 + 819087800747125*x^6 - 798550011094073*x^5 + 729734808064227*x^4 - 562691756062212*x^3 + 407486767661645*x^2 - 201294019183845*x + 99519182315771)
# Defining polynomial:
K.defining_polynomial()
# Degree over Q:
K.degree()
# Signature:
K.signature()
# Discriminant:
K.disc()
# Ramified primes:
K.disc().support()
# Autmorphisms:
K.automorphisms()
# Integral basis:
K.integral_basis()
# Class group:
K.class_group().invariants()
# Unit group:
UK = K.unit_group()
# Unit rank:
UK.rank()
# Generator for roots of unity:
UK.torsion_generator()
# Fundamental units:
UK.fundamental_units()
# Regulator:
K.regulator()
# Analytic class number formula:
# self-contained SageMath code snippet to compute the analytic class number formula
x = polygen(QQ); K. = NumberField(x^42 - 21*x^41 + 231*x^40 - 1750*x^39 + 10395*x^38 - 52269*x^37 + 233611*x^36 - 952918*x^35 + 3599785*x^34 - 12710201*x^33 + 42287014*x^32 - 133370664*x^31 + 400618099*x^30 - 1149584975*x^29 + 3160451592*x^28 - 8341179427*x^27 + 21174580693*x^26 - 51755274760*x^25 + 121953514697*x^24 - 277155797093*x^23 + 608007380806*x^22 - 1287295716241*x^21 + 2631847521996*x^20 - 5192066875520*x^19 + 9886990587068*x^18 - 18146977046303*x^17 + 32112635555588*x^16 - 54655115299659*x^15 + 89504829240548*x^14 - 140479267770793*x^13 + 211514505374151*x^12 - 303526580264439*x^11 + 416119886096880*x^10 - 538840804150264*x^9 + 662937764461147*x^8 - 758558920220686*x^7 + 819087800747125*x^6 - 798550011094073*x^5 + 729734808064227*x^4 - 562691756062212*x^3 + 407486767661645*x^2 - 201294019183845*x + 99519182315771)
DK = K.disc(); r1,r2 = K.signature(); RK = K.regulator(); RR = RK.parent()
hK = K.class_number(); wK = K.unit_group().torsion_generator().order();
2^r1 * (2*RR(pi))^r2 * RK * hK / (wK * RR(sqrt(abs(DK))))
# Intermediate fields:
K.subfields()[1:-1]
# Galois group:
K.galois_group(type='pari')
# Frobenius cycle types:
# to obtain a list of $[e_i,f_i]$ for the factorization of the ideal $p\mathcal{O}_K$ for $p=7$ in Sage:
p = 7; [(e, pr.norm().valuation(p)) for pr,e in K.factor(p)]