What is the cardinality of the following set
$\{{\bf x}=(x_1,\ldots,x_d): \text{each } x_i\in \{ 1,\dots,n \},\text{ and } \gcd({\bf x})=1\}$,
where $\gcd({\bf x})$ is the greatest common divisor of $x_1,\ldots,x_d$.
A condition we have is that we know the amount of prime numbers in $\{ 1,\dots,n \}$, which is denoted as $n_p$.
I think we first need to find those with $x_1<\dots<x_d$, then handle those with $x_i=x_j$, and then easily for non-monotone cases. Note that ${\bf x}$ is a row vector, so the order of $x_i$ matters.
I hope I could obtain an explicit formula for the set's cardinality by using $n,d,n_p$.
I do not see a simple closed formula, but here is one that uses summation.
If we ignore the requirement on the greatest common divisor, we have $d$ successive choices to make, each choice with $n$ possibilities. This would mean $n^d$ cardinality for your set.
But we must remove the elements with $\gcd>1$. For those vectors whose $\gcd$ is $2$, we can get each of them by taking a vector with choices from $\{1,2,\ldots,\left\lfloor\frac n2\right\rfloor\}$ (where $\lfloor\cdot\rfloor$ is the greatest integer function) and multiplying each vector member by $2$. So we need to remove $\left\lfloor\frac n2\right\rfloor^d$ set elements. For $\gcd=3$ we remove $\lfloor\frac n3\rfloor^d$ set elements.
For $\gcd=4$, those were included in the ones for $\gcd=2$, so we can ignore them. For $\gcd=6$, we have included them once and removed them twice, for $2$ and for $3$. So we need to add back $\left\lfloor\frac n6\right\rfloor^d$ set elements.
You probably see the idea. For $k$ prime or the product of an odd number of distinct primes, we subtract those set elements, for $k$ one or the product of an even number of distinct primes we add them, and for $k$ divisible by the square of a prime we ignore them. The Möbius mu function, $\mu(k)$, does just what we want. So your desired cardinality is
There probably is a way to abbreviate that, but I don't know it. Note that I did not use or need $n_p$, though perhaps that may be usable in an abbreviation. I checked my formula with several examples in Microsoft Excel, and they all check.