Show that an ideal of the ring of integers of a real number field is not principal

Here is an ad hoc way to prove $\mathfrak{p}=(2,\sqrt{82})$ is not principal. The fundamental unit of $\mathbb{Q}(\sqrt{82})$ is $\varepsilon = 9+\sqrt{82}$.

The idea is to use information at the Archimedean place. You already know $\mathfrak{p}^2 = (2)$. Assume $\mathfrak{p}=(a)$ for some $a\in \mathbb{Z}[\sqrt{82}]$, we can assume $1<a<\varepsilon$. Then $a^2 = 2\varepsilon^n$ for some $n\in \mathbb{Z}$. That is, $$\frac{1}{2} < \varepsilon^n < \frac{\varepsilon^2}{2}$$ the only case is $n=0, 1$. But you can easily check $2$ and $2\varepsilon$ are not squares in $\mathbb{Q}(\sqrt{82})$.


Your follow up question: for general number fields, we have algorithm to determine whether a given ideal is principal, but the complexity increases exponentially as the degree, and is as hard as finding a system of fundamental units. See chapters 4,5,6 of A Course in Computational Algebraic Number Theory by Henri Cohen.

For real quadratic field, which the problem amounts to solve a Pell equation, more specialized algorithm is known, like continued fraction.