For a given real quadratic field $K$, the group of units of its ring of integers is $\mathcal{O}\_K^{\times}\cong(\pm1)\times \mathbb{Z}$ by the Dirichlet unit theorem. For each $\mathcal{O}\_K$, pick the fundamental unit as $\epsilon >1$, then $\epsilon=m\sqrt{d}+n$, where $m,n>0$ are integers or half integers. Now for a large variable $x>>1$, define the counting function $$
 u(x):=\sum\_{1<\epsilon<x} 1,
$$
where the sum is over all real quadratic fields. 


Firstly the sum is finite, since by the above token, there are only finitely many $\epsilon=m\sqrt{d}+n$ with bounded absolute value as $d\rightarrow\infty$.


What asymptotic information is known about $u(x)$? 



Counting fundamental units of real quadratic fields
First, let's count


$$ v(x) = \sum\_{1 < \mu < x} 1 $$


where $\mu$ ranges over every unit greater than $1$ of every real quadratic field.


Setting $\mu = m \sqrt{d} + n$, we require $n^2 - m^2 d = \pm 1$. Given that equation, the inequalities are equivalent:


$$ 1 < \mu < x \Longleftrightarrow 1 < n < \frac{x^2 \pm 1}{2x} $$


For each choice of half-integer $n$ and choice of sign, there is a unique solution for $m,d$ with $d$ a squarefree integer. This solution will have $m > 0$.


Consequently, we can count units simply by counting the number of half-integers $n$ and counting signs:


$$ v(x) = 2x + O(1)$$




---


Another way to count every unit greater than $1$ is by observing it is a positive power of the fundamental unit. If we count them, their squares, their cubes, and so forth, we get:


$$ v(x) = \sum\_{k=1}^{\infty} \sum\_{1 < \epsilon^k < x} 1 = \sum\_{k=1}^{\infty} u(x^{1/k}) $$


which we can reverse via inclusion-exclusion to get


$$ u(x) = \sum\_{k=1}^{\infty} \mu(k) v(x^{1/k}) $$


and consequently,


$$ u(x) = 2x - 2\sqrt{x} - 2\sqrt[3]{x} + O(\sqrt[5]{x}) $$


