# Finding a certain ideal

Hey SAGE-Community,

I am new to SAGE and looking for some help for a small university project.
Given 𝒪_{K} as the ring of integers to K=ℚ(√5). Given also a totally negative number *d* ∈ 𝒪_{K}^{2}. How can I calculate the largest integral ideal **f** in K whose square divides *d* such that *d* is a square modulo 4 **f**?

I guess that both questions are rather easily done in SAGE but I am missing the necessary experience. Anyways, thanks a lot in advance!

Is this an example of what you want?

`K.<a> = NumberField(x^2 - 5); OK = K.ring_of_integers(); d = -4; f = OK.fractional_ideal(2); I = 4*f; I.reduce(d) in set(I.reduce(c^2) for c in I.residues())`

gives`True`

. It could help someone write an answer.Hey rburing, thanks for your feedback. This sounds correct, but I am still not sure on how to find the ideal in general.