Ask Your Question

Revision history [back]

Is this what you are looking for?

Define the number fields and their rings of integers.

sage: K.<a> = NumberField(x^2+5)
sage: L.<i> = K.extension(x^2+1)
sage: OK = K.ring_of_integers()
sage: OL = L.ring_of_integers()

Define the ideals generated by 2 and by a+1.

sage: J = OL.principal_ideal(2)
sage: JJ = OL.principal_ideal(a + 1)

Take the sum.

sage: J + JJ
Fractional ideal (-i + 1)

Is this what you are looking for?

Define the number fields and their rings of integers.

sage: K.<a> = NumberField(x^2+5)
sage: L.<i> = K.extension(x^2+1)
sage: OK = K.ring_of_integers()
sage: OL = L.ring_of_integers()

Define the ideals generated by 2 and by a+1.

sage: J = OL.principal_ideal(2)
sage: JJ = OL.principal_ideal(a + 1)

Take the sum.

sage: H = J + JJ
JJ; H
Fractional ideal (-i + 1)

Prime factors.

sage: H.prime_factors()
[Fractional ideal (-i + 1)]

sage: H.is_prime()
True