# Revision history [back]

In this special situation one can ask for the following:

sage: K.<a> = QuadraticField( -13 )
sage: ideal = K.ideal( K(7) )
sage: ideal.factor()
(Fractional ideal (7, a + 1)) * (Fractional ideal (7, a + 6))
sage: for factor in ideal.factor():
print factor, "with norm", factor[0].norm()
....:
(Fractional ideal (7, a + 1), 1) with norm 7
(Fractional ideal (7, a + 6), 1) with norm 7


The ideal has the above decomposition, but the factors are not principal. Strictly speaking, we are performing arithmetics not in the field, but in its ring of integers or in some subring / order. Then a non-trivial representation $7 = st$ with $s, t$ non-units would lead to $7^2 = N(7)=N(st)=N(s)\, N(t)$, and the only way to arrange for two non-unit norms would be with $N(s) = N(t) = 7$. So one can equivalently search for such elements without asking sage to factor. The search is quickly done for small values to be factorized. And there is in general a quick theoretical answer if a prime $p$ is of the shape $a^2 +13 b^2$ (in a non-trivial way). We look at $p=a^2 +13 b^2$ as an equality in integers and pass modulo $13$. So $p$ must be a quadratic residue modulo $13$ if there is such a representation. And the theory takes care of the other direction. For our situation we have the choice to alternatively ask for:

sage: legendre_symbol( 7, 13 )
-1
sage: jacobi_symbol( 7, 13 )
-1
sage: kronecker_symbol( 7, 13 )
-1
sage: GF(13)(7).is_square()
False


(For an order we have to continue investigations.)