Consider the algebraic integers in $\mathbb{Q}(\sqrt{d})$ for $d> 0, d \neq 1$. It can easily be shown that they are $$\mathbb Z[\sqrt{d}] \quad \text{if} \quad d\equiv2,3 \pmod4$$ $$\mathbb Z \left[ \frac{1+\sqrt{d}}{2} \right] \quad \text{if} \quad d\equiv1 \pmod4.$$ Also it can be shown that algebraic integers form a ring. I tried to find subrings of that ring.
My first approach was to find all rings that are generated by only one element, and than two, three ... So I Googled it and found that you can generate most subrings by two elements.
Is there way to show that a subring generated by three elements can also be generated at most two elements?
Let's denote the ring of integers of $\mathbb{Q}(\sqrt d)$ by $\mathcal{O}_K$. Recall that $\mathcal{O}_K$ is a free $\mathbb{Z}$-module of rank 2. Now any subring $R\subset\mathcal{O}_K$ has to contain $\mathbb{Z}$ and hence can be viewed as a submodule of $\mathcal{O}_K$. Since $\mathbb{Z}$ is a PID, $R$ is also a free $\mathbb{Z}$-module of rank at most 2 and $R$ can be generated by 2 generators as a module.