Find all sets $S$ of positive integers that satisfy all of the following. $1.$ If $a,b$ are two not necessarily distinct elements in $S$, then $\gcd(a,b)$, $ab$ are also in $S$. $2.$ If $m,n$ are two positive integers with $n\nmid m$, then there exists an element $s$ in $S$ such that $m^2\mid s$ and $n^2\nmid s$. $3.$ For any odd prime $p$, the set formed by moduloing all elements in $S$ by $p$ has size exactly $\frac{p+1}2$.
Problem
Source: IMOC 2021 N5
Tags: number theory, greatest common divisor, Sets
12.08.2021 23:12
Answer : $S = \{1 , 4 , 9 , 16 , 25 , \dots \}$. It is easy to check that this set works. Now we prove this is the only one. Take some $S$ that satisfies the conditions. We claim that $S$ only consists of perfect squares. To prove that, assume $x \in S$ and $x$ is not a perfect square. Then, there exists infinitely many primes such that $x$ is not a quadratic residue. So choose a large prime $p$ such that $x$ is not a quadratic residue. Let $a_1 , a_2 , \dots , a_{\frac{p-1}{2}}$ be the set of non-zero distinct residues formed by moduloing the elements of $S$. (Clearly $0$ is also in the set formed by moduloing all elements of $S$ by $p$ , because of condition 2.) Then, $xa_1 , xa_2 , \dots , xa_{\frac{p-1}{2}}$ are still all distinct modulo $p$ and they are in $S$ by condition 1, and thus $$\prod_{i=1}^{\frac{p-1}{2}} xa_i \equiv \prod_{i=1}^{\frac{p-1}{2}} a_i \pmod{p} \implies x^{\frac{p-1}{2}} \equiv 1 \pmod{p},$$implying that $x$ is a quadratic residue modulo $p$ by Euler's Criterion, contradiction. Now take some arbitrary prime $p$. Denote $K = \{a \in S : p^2 \mid a \}$. Clearly $|K| > 0$ by condition 2. Denote by $p^2m^2$ the gcd of all the elements in $K$. Assume $m \geq 2$. If $m \nmid p$, this yields a contradiction since there will not exist an element $s \in S$ such that $p^2 \mid s$ and $m^2 \nmid s$. So, $m = p$ and $p^4$ is the gcd of all the elements in $K$. But then, taking $n = p^2$ and $m = p$ in condition 2 yields a contradiction since there doesn't exist any element $s \in S$ such that $p^2 \mid s$ and $p^4 \nmid s$. Thus, $m = 1$. This means there exists $a,b \in K$ such that $\gcd{(a,b)} = p^2$. So by condition 1, $p^2 \in S$. So since $p$ was arbitrary, all prime squares are in $S$. And since $S$ is closed under multiplication, this means all the perfect squares $\geq 4$ are in $S$. Also, one can easily prove by the same method that $1 \in S$. (Again assume gcd is $\geq 2$ and take $m = 1$ in condition 2 to arrive at a contradiction.) Thus $S = \{1 , 4 , 9 , 16 , 25 , \dots \}$.