# Set of prime numbers and subrings of the rationals

Let $P$ denote a set of prime numbers and let $R_{P}$ be the set of all rational numbers such that $p$ does not divides the denominator of elements of $R_{P}$ for every $p \in P$.

If $R$ is a subring of $\mathbb{Q}$ containing $\mathbb{Z}$, why we can always find a set of prime numbers $P$ such that $R=R_{P}$?

-

Let $R$ be a subring of $\mathbb{Q}$ containing $\mathbb{Z}$. Let $P$ be the set of all primes that do not divide the denominator of any element of $R$ when written in lowest form. Clearly, $R\subseteq R_P$.

I claim that $R=R_P$. To see this, it suffices to show that $R$ contains $\frac{1}{q}$ for any prime $q$ not in $P$ (for then any element of the form $\frac{a}{b}$ with $\gcd(a,b)=1$ and $b$ divisible only by primes not in $P$ will be a product of elements of the form $\frac{1}{q}$ with $q$ not in $P$, and an integer, all in $R$).

Let $q$ be a prime not in $P$. Then there is $\frac{s}{t}\in R$, $\gcd(s,t)=1$, such that $q|t$. Multiplying by the integer $\frac{t}{q}$ we obtain that $\frac{s}{q}\in R$, with $\gcd(s,q)=1$. Let $\alpha$ and $\beta$ be integers such that $\alpha s + \beta q = 1$. Then $$\alpha\frac{s}{q} + \beta = \frac{\alpha s + \beta q}{q} = \frac{1}{q}\in R$$ (it lies in $R$ because $\alpha$, $\beta$, and $\frac{s}{q}$ are all in $R$).

This proves that $R$ contains all $\frac{1}{q}$ with $q$ not in $P$, and since $\mathbb{Z}\subseteq R$, it follows that $\mathbb{R}_P\subseteq R$, giving equality.

-

Suppose $\frac{a}{b}\in R\subseteq\mathbb{Q}$ is in lowest terms, and $p\mid b$. Then $\frac{a}{p}\in R$, of course, and because $\frac{a}{b}$ was in lowest terms, $\gcd(a,b)=1$, and hence $\gcd(a,p)=1$. Thus, there exists a $c\in\mathbb{Z}$ such that $ac\equiv 1\bmod p$, so $\frac{ac}{p}=n+\frac{1}{p}$ for some $n\in\mathbb{Z}$. Because $\frac{a}{p}\in R$ and $n\in R$ (any subring of $\mathbb{Q}$ has to contain $\mathbb{Z}$), we have that $\frac{1}{p}\in R$.

Thus, if $p$ occurs as the divisor of the denominator of any element of $R$, then $\frac{1}{p}\in R$. The converse is obvious. Thus, given a subring $R$, let $$P=\{\text{primes not occurring as divisors of denominators of elements of }R\}=$$ $$\{\text{primes }p\text{ such that }\tfrac{1}{p}\notin R\}$$ Given any $\frac{a}{b}\in\mathbb{Q}$ in lowest terms, if $\frac{a}{b}\in R$ then $p\nmid b$ for any $p\in P$. Thus, $R\subseteq R_P$.

Given any $\frac{a}{b}\in\mathbb{Q}$ in lowest terms, if $\frac{a}{b}\in R_P$ then we have that $p\mid b\implies p\notin P\implies \frac{1}{p}\in R$.
If $b=p_1^{a_1}\cdots p_k^{a_k}$ is the prime factorization of $b$, then because $\frac{1}{p_1},\ldots,\frac{1}{p_k}\in R$, we get that $$\frac{a}{b}=a\cdot\left(\tfrac{1}{p_1}\right)^{a_1}\cdots\left(\tfrac{1}{p_k}\right)^{a_k}\in R$$ so that $R_P\subseteq R$. Therefore, $R=R_P$.

-