I am currently running into a problem related to coprime numbers.
Consider a set of $d$-dimensional integer vectors, $z \subset \mathbb{Z}^d$ such that each component $z_i$ is bounded by another integer $K$. Let us denote this set as:
$$Z_K^d = \Big \{ z \in \mathbb{Z}^d ~\big|~ z_i \in \{0,1,\ldots,K \} ~ i = 1,\ldots, d \Big\}$$
We can visualize $Z_K^d$ as the set of integer coordinates within a $d$-dimensional hypercube of size $K+1$. Note that $Z_K^d$ contains $\big|Z_K^d\big| = (K+1)^d$ distinct vectors, as each of its $d$ components can take on $K+1$ values.
I am interested in determining the number of vectors $z \in Z_d^K$ that are coprime. Formally, a vector $z \in Z_d^K$ is said to be coprime if the greatest common divisor of all of it's components is 1. As explained in the Wiki article, we can also think of these vectors as points with integer coordinates that are 'visible' from the origin (in the sense that there is no other point with integer coordinates between these points and the origin).
Let us denote this subset of coprime vectors $P_K^d \subseteq Z_K^d$ and define it as:
$$P_K^d = \Big \{ z \in Z_K^d ~\big| ~\text{gcd}(z_1,\ldots,z_d)=1 \Big\}$$
I am wondering if there is a closed-form expression or a closed-form upper bound for the density of these coprime vectors in my original set:
$$\gamma_K^d = \frac{\big|C_K^d\big|}{\big|Z_K^d\big|}$$
I have been actively reading up on the topic (which is outside of my area of expertise) and it seems that the value of $\gamma_K^d$ is asymptotically related to the Riemann zeta function as
$$ \lim_{K\rightarrow\infty} \gamma_K^d = \zeta(d)$$
While this is insightful, it does not take into account that the set that I am interested in is bounded. In addition, the value of $\zeta(d)$ can either be an upper bound or a lower bound on this ratio (so I cannot use it in another bound).
Every $z \in Z_K^d \setminus \{0\}$ has a unique representation as $z = g\cdot c$ with a positive integer $g$ and $g \in C_K^d$. Obviously, $g \leqslant K$.
Let us call $F(K) := \lvert C_K^d\rvert$, and $G(K) := \lvert Z_K^d\rvert - 1$. Then the unique representation mentioned above yields the identity
$$G(K) = \sum_{g=1}^K F\left(\left\lfloor\frac{K}{g} \right\rfloor\right).\tag{1}$$
By generalised Möbius inversion, that is equivalent to
$$F(K) = \sum_{g=1}^K \mu(g) G\left(\left\lfloor\frac{K}{g} \right\rfloor\right),\tag{2}$$
where $\mu$ is the Möbius function. It is easy to derive the limit
$$\lim_{K\to\infty} \frac{G(K)}{F(K)} = \zeta(d)$$
from $(2)$, but $(2)$ also allows a reasonably efficient way to compute $F(K)$. The computation can be sped up by some rearrangements, $O(K^{3/4})$ computation steps are easily achieved by rewriting the consequence of $(1)$
$$F(K) = G(K) - \sum_{g=2}^K F\left(\left\lfloor\frac{K}{g} \right\rfloor\right)$$
to
$$\begin{align} F(K) &= G(K) - \left(G\left(\lfloor K/2\rfloor\right) - \sum_{h=2}^{\lfloor K/2\rfloor} F\left(\left\lfloor\frac{K}{2h} \right\rfloor\right) \right) - \sum_{g=3}^K F\left(\left\lfloor\frac{K}{g} \right\rfloor\right)\\ &= \left(G(K) - G(\lfloor K/2\rfloor)\right) - \sum_{k = 1}^{\lfloor (K-1)/2\rfloor} F\left(\left\lfloor\frac{K}{2k+1} \right\rfloor\right)\tag{3} \end{align}$$
and noting that the expression $\displaystyle \left\lfloor \frac{K}{2k+1}\right\rfloor$ is constant for considerable stretches of $k$ when $k \geqslant c\sqrt{K}$ (I've forgotten what constant $c$ was, $\frac12$ I believe).