Fix integers $n,d>0$. (I'm probably thinking about $n\leq 6$ and $d\leq 2000$.) Let $X$ be the set of matrices $A\in U(n)$ such that the entries of $dA$ lie in $\mathbb{Z}[i]$.

- Is there an exact or approximate formula for $|X|$?
- Is there an efficient algorithm to enumerate most or all the elements of $X$?
- How evenly are the points of $X$ distributed with respect to Haar measure on $U(n)$?
- Is there a good numerical measure of the evenness of distribution that can be calculated easily after we have found all the points in $X$?

It may (or may not) be easier to think about analogous questions for $SO(n)$ or $SU(n)$ first. Also, I do not think I have seen any discussion of rational points with unrestricted denominators, so pointers to literature about that would be a good start. I might be willing to work with a slightly different set $X'$, so long as it was still a finite set of rational points defined by a straightforward arithmetic criterion.

Note that there is an algebraic group $G$ defined over $\mathbb{Z}$ with $G(\mathbb{R})=U(n)$ and $X\subset G(\mathbb{Q})$. I am guessing that some Langlands-like stuff may be relevant, but I know very little about that sort of thing.

For $U(1)$, we know that every rational point (other than $z=-1$) has the form $$ z = \frac{1+it}{1-it} = \frac{1-t^2}{1+t^2} + \frac{2t}{1+t^2}i $$ with $t\in\mathbb{Q}$. If $t=a/b$ in lowest terms then I think that the denominator of $z$ is $a^2+b^2$. I suspect that if $a^2+b^2=p_1\dotsb p_r$ (with $p_k$ prime) then we can write $z=z_1\dotsb z_r$ where $z_k\in U(1)$ and $z_k$ has denominator $p_k$. Anyway, there are certainly connections with well-known questions in number theory. This also covers the equivalent case of $SO(2)$.

Similarly, if $Z\in U(n)$ and $Z+I$ is invertible (which is usually true) then $Z=(1+iT)(1-iT)^{-1}$ for a unique self-adjoint matrix $T$. If $Z$ has entries in $\mathbb{Q}[i]$ then so will $T$. However, it does not seem easy to say anything about the denominators of $T$ and $Z$.