Show $r=a/b,a,b\in\mathbb{Z}$ given $\text{ord}_{p_i}a\geq\text{ord}_{p_i}b$ is a ring Let $p_1,p_2,\cdots,p_t\in\mathbb{Z}$ be primes and consider the set of all rational numbers $r=a/b, a,b\in\mathbb{Z}$ so that $\text{ord}_{p_i}a\geq\text{ord}_{p_i}b$ for $i=1,2,\cdots,t$. Show that this set is a ring and that up to taking associates $p_1,p_2,\cdots,p_t$ are the only primes.
I don't think I am thinking of $\text{ord}_{p_i}a\geq\text{ord}_{p_i}b$ correctly. I want to show this is a ring by using the subring test.
$3/2$ and $4/3$ are elements of $r\subset\mathbb{Q}$, but $3/2-4/3=1/6$, where clearly $1<6$.
I know to show primes up to associates, I need an element $c/d$ so that $a/b=c/d\cdot u$, where $u$ is a unit. I think the only case here is $u=1$, implying $a/b=a/b\cdot1$. Are there other units I need to consider?
 A: $\DeclareMathOperator{\ord}{\operatorname{ord}}$Let $R$ be the given set.
As mentioned in the comments, given rational $r$, $r \in R$ if and only if
$$r = \frac{c}{d} \prod_{i=1}^t p_i^{e_i}$$
for integer $c,d,e_i$, where $e_i \geq 0$ for each $i$ and $d$ is coprime to the $p_i$. Observe that it is equivalent to assert that $e_i\geq 0$ and both $c$ and $d$ are coprime to the $p_i$ (we can pull out any extra $p_i$ that are in $c$).
Why is this?
For the forward direction, suppose you have some $r = a/b \in R$. Then $\ord_{p_i}(a) \geq \ord_{p_i}(b)$ for each $i$. So,
$$\frac{a}{b} = \left( \frac{a/\prod_{i=1}^t p_i^{\ord_{p_i}(a)}}{b/\prod_{i=1}^t p_i^{\ord_{p_i}(b)}} \right) \prod_{i=1}^t p_i^{\ord_{p_i}(a) - \ord_{p_i}(b)}.$$
The denominator $d := b/\prod_{i=1}^t p_i^{\ord_{p_i}(b)}$ of the fraction is coprime to each $p_i$, and $e_i := \ord_{p_i}(a) - \ord_{p_i}(b) \geq 0$ for each $i$.
Can you check the reverse direction on your own?

Now, let us check closure under multiplication.
Let $r_1 = a_1/b_1\prod_{i=1}^t p_i^{d_i}$ and $r_2 = a_2/b_2 \prod_{i=1}^t p_i^{e_i}$ be elements of $R$, where $d_i, e_i \geq 0$ and $b_1$, $b_2$ are coprime to the $p_i$. Then,
$$r_1r_2 = \frac{a_1a_2}{b_1b_2} \prod_{i=1}^t p_i^{d_i + e_i}.$$
Clearly, $b_1b_2$ is coprime to the $p_i$ because each of $b_1$ and $b_2$ are, and $p_i$ is a prime. It follows that $r_1r_2 \in R$ since $d_i+e_i \geq 0$ for each $i$.

Next, we shall check closure under subtraction.
As before, let $r_1,r_2\in R$ with the same notation. For starters, what happens when $t=1$? Suppose $d_1 \geq d_2$.
$$\begin{align*}
r_1 - r_2 &= \frac{a_1}{b_1} p_1^{d_1} - \frac{a_2}{b_2} p_2^{d_2} \\
&= p_1^{d_2} \left( \frac{a_1}{b_1} p_1^{d_1 - d_2} - \frac{a_2}{b_2} \right) \\
&= p_1^{d_2} \left(\frac{a_1b_2p_1^{d_1 - d_2} - a_2b_1}{b_1b_2}\right)
\end{align*}
$$
$b_1b_2$ is coprime to $p_1$ since $b_1$ and $b_2$ separately are, and $d_2 \geq 0$ so $r_1 - r_2 \in R$.
In the general case (for any $t$),
$$
\begin{align*}
r_1 - r_2 &= \frac{a_1}{b_1} \left( \prod_{i=1}^t p_i^{d_i} \right) - \frac{a_2}{b_2} \left( \prod_{i=1}^t p_i^{e_i} \right) \\
&= \left( \frac{a_1}{b_1} \prod_{i=1}^t p_i^{d_i - \min\{d_i,e_i\}} - \frac{a_2}{b_2} \prod_{i=1}^t p_i^{e_i - \min\{d_i,e_i\}} \right) \prod_{i=1}^t p_i^{\min\{d_i,e_i\}}
\end{align*}
$$
The term within the parentheses simplifies to some rational with denominator $b_1b_2$, which is coprime to the $p_i$. We also have $\min\{d_i,e_i\} \geq 0$ for any $i$, so it follows that $r_1 - r_2 \in R$.
The multiplicative identity $1$ is in $R$, so $R$ is a ring by the subring test.


Are there other units I need to consider?

Any element of the form $c/d$, where both $c$ and $d$ are coprime to the $p_i$, is a unit.
Let
$$r = \frac{c}{d}\prod_{i=1}^t p_i^{e_i}$$
where both $c$ and $d$ are coprime to $p_i$ and $e_i \geq 0$ for each $i$. Further suppose that $e_i \neq 0$ for some $i$, that is, $r$ is not a unit.
We wish to show that $r$ is a prime if and only if $\sum_{i} e_i = 1$ (that is, $e_j = 1$ for some $j$ and $e_i = 0$ for $i\ne j$).

*

*The forward direction can be shown via the contrapositive. Indeed, if $\sum_i e_i \geq 2$, then we can write $r = r_1 r_2$ such that neither $r_1$ nor $r_2$ is a unit (try splitting the prime powers between the $r_j$), and $r \nmid r_1, r_2$.

*For the other direction, it is straightforward to show that if $e_j = 1$ for some $j$ and $e_i = 0$ for $i\neq j$, and $r \mid r_1r_2$, then there must be a power of $p_j$ in either $r_1$ or $r_2$, so $r \mid r_1$ or $r\mid r_2$.

A: Let $R$ be the given set.
First, note that $r \in \Bbb Q$ is an element of $R$ iff $r$ can be written as $a/b$ such that $p_i \nmid b$ for all $i$. In other words, we have
$$R = \left\{\frac{a}{b} : a, b \in \Bbb Z,\, p_i \nmid b \text{ for all } i \in \{1, \ldots, t\}\right\}.$$
Using just the above characterisation, it is quite direct to note that $R$ is a ring.
Also, it is easy to note that any denominator $b$ is a unit in $R$. Said more precisely, given any $r \in R$, it has an associate $r' \in \Bbb Z$. From this, the question about primes just reduces to finding integers which are primes in $R$. Clearly, any integer which was not a prime in $\Bbb Z$ is still not a prime in $R$. Moreover, any integer prime outside $\{\pm p_1, \ldots, \pm p_t\}$ has now become a unit.
Thus, we just need to verify each $p_i$ is indeed a prime in $R$. The only thing to really check is that $p_i$ is not a unit. This is simple to do.
To now see that it is a prime, it suffices to again work with just integers since every element of $R$ has an integer associate. But now the result follows since $p_i$ was a prime in $\Bbb Z$, to begin with.

Here's a more general perspective, if you know localisation.
Let $\mathfrak p_i := \langle p_i \rangle$ be the prime ideal in $\Bbb Z$ generated by $p_i$. Consider the multiplicative set $S := \Bbb Z \setminus (\mathfrak{p}_1 \cup \cdots \cup \mathfrak{p}_t)$.
Then, $R$ is precisely the localisation of $\Bbb Z$ at $S$. In particular, it is a ring. (Note that $\Bbb Z$ is an integral domain and so, every localisation can be seen as a subring of $\Bbb Q$.)
[In fact, the checks you would do to show that $R$ is a ring in the first method is essentially mimicking (a part of) the construction of $S^{-1}R$.]
Moreover, since $\Bbb Z$ was a PID, so is $R$. Thus, the question of finding the prime elements comes down to finding all the prime ideals of $R$. Again, the general theory of localisation tells us that prime ideals of $R$ are precisely those of the form $S^{-1}\mathfrak{p}$ where $\mathfrak{p}$ is a prime ideal not intersecting $S$. In our case, this is equivalent to $\mathfrak{p} \subset \bigcup_i \mathfrak{p}_i$. By prime avoidance, this is possible iff $\mathfrak{p} = \mathfrak{p}_i$ for some $i$ or $\mathfrak{p} = 0$.
This answers the question about all primes in $R$ as well.
