Problem

Source: IMOC 2021 N5

Tags: number theory, greatest common divisor, Sets



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$.