sage: R.<x> = QQ[] sage: f = x^5 + 7*x^4 + 3*x^2 - x + 1

Then we create the corresponding number field obtained by adjoining a root of , and find its ring of integers.

sage: K.<a> = NumberField(f) sage: OK = K.ring_of_integers() sage: OK.basis() [1, a, a^2, a^3, a^4]

We define the ideal and factor - it turns out to be prime.

sage: I = K.fractional_ideal(2); I Fractional ideal (2) sage: I.factor() Fractional ideal (2) sage: I.is_prime() True

Finally we factor , which factors as a product of three primes.

sage: I = K.fractional_ideal(5); I Fractional ideal (5) sage: I.factor() (Fractional ideal (5, a^2 + 9*a + 2)) * (Fractional ideal (5, a + 2)) * (Fractional ideal (5, a + 3))^2Notice that the polynomial factors in a similar way:

sage: f.factor_mod(5) (x + 2) * (x + 3)^2 * (x^2 + 4*x + 2)Thus is already a prime ideal, and

The exponent of in the factorization of above suggests ``ramification'', in the sense that the cover has less points (counting their ``size'', i.e., their residue class degree) in its fiber over than it has generically.

William Stein 2012-09-24