# find the generator of an ideal of an order

I'm reading Cohen's A Course in Computational Algebraic Number Theory, and I'm confused by the complexity of the algorithms for determining if an ideal of an order is principal, and finding its generator if it is.

I'm thinking that this should be straightforward - the ideal is a module over the order, so just compute a minimal free resolution of the ideal (as a module over the order). If the ideal is principal, then the resolution should look like this ($$M$$ is the ideal):

$$0 \to \mathcal{O} \to M \to 0$$

and the image of $$1$$ in the $$\mathcal{O} \to M$$ mapping should give me the generator.

I must be missing something here. Why doesn't this work?

As you correctly say, $$M$$ has a resolution of that form if and only if $$M$$ is principal, but determining whether such a resolution exists is really just a rephrasing of the problem that you started with. For example, suppose that $$\mathcal{O} = \mathbf{Z}[\sqrt{-5}]$$ and $$M = (29,\sqrt{-5} - 13)$$. Then you have a natural surjection $$\mathcal{O}^2 \rightarrow M$$ but it's not clear from this description whether $$M$$ is principal or not. To see whether $$M$$ is principal or not (it is) requires some more thought.