Ring of integers of a quadratic field when not square-free I know what the ring of integers of $\mathbb{Q}(\sqrt{d})$ looks like when $d$ is square free, but what is the ring of integers for $\mathbb{Q}(\sqrt{d})$ for $d=18,45$ etc. Can I just remove the square factors?
Thank you
 A: What you are asking has nothing to do with rings of integers, but simply with the definition of $\mathbb{Q}(\sqrt{d})$:
$$\mathbb{Q}(\sqrt{d})=\{a+b\sqrt{d} : a,b\in\mathbb{Q}\}.$$
Now suppose that $d$ is an arbitrary integer. Then, we can find integers $n\geq 1$ and $f\in\mathbb{Z}$ such that $d=n^2f$, and $f$ is square-free. 
Hence, $\mathbb{Q}(\sqrt{d})=\mathbb{Q}(\sqrt{f})$. Let's see this:


*

*If $\alpha=a+b\sqrt{d}\in\mathbb{Q}(\sqrt{d})$, then 
$\alpha=a+b\sqrt{d}=a+b\sqrt{n^2f}=a+bn\sqrt{f}\in\mathbb{Q}(\sqrt{f})$. 

*Conversely, if  $\beta=u+v\sqrt{f}\in\mathbb{Q}(\sqrt{f})$, then 
$$\beta=u+\frac{v}{n}\cdot n \sqrt{f}= u+\frac{v}{n} \sqrt{d}\in \mathbb{Q}(\sqrt{d}).$$
Notice that the argument above can be modified slightly to show that, in fact, for every rational number $d\in\mathbb{Q}$ there is a square-free integer $f\in\mathbb{Z}$ such that $\mathbb{Q}(\sqrt{d})=\mathbb{Q}(\sqrt{f})$.
A: Well it is quite obvious that say $\mathbb{Q}(\sqrt{18}) = \mathbb{Q}(\sqrt{2})$. This just boils down to the fact that $\sqrt{18} = 3\sqrt{2}$, which is a rational multiple of $\sqrt{2}$.
