Skip to main content
1 of 3

We can see that $x$ must not divide the product of the other elements of $S$ because if it does,$$\mathrm{gcd}\bigg(x,\prod_{y\in S\setminus\{x\}}y\bigg)=x\geq \frac{x}{k}$$ for every $k\geq 1$ .Erdos has proved that every set $S$ with the above property must have $\pi(n)$ elements at most.

"Let $a_n$ be a sequence of positive integers with $1<a_1<\cdots<a_n\leq N$ which has the property:
$a_i\nmid \frac{a_1\cdot a_2\cdots a_n}{a_i}$ for every $i=1,...,n$ .Then $n\leq \pi(N)$ holds"

So, your set must have at most $\pi(n)$ elements.
On the other hand, if your set contains at least $\pi(n)+1$ elements it could contain 2 powers of the same prime,$p,p^m$ and so the gcd you want would be at least $x=p$ (or $x=p^m$).
I think it would be more difficult to determine the asymptotic size of $S$ depending on $k$ but certainly $|S|\leq\pi(n)$ holds for a random set $S$ as you require.