Prime Ideals and Maximal Ideals. 
Let $n\in \mathbb{Z}$ be a non-zero integer. Let us define:
  $$\mathbb Z\left[\frac{1}{n}\right] := \left\{\left.\frac{a}{n^r}\, \right\rvert\, a,r\in \mathbb{Z}, r \geq 0\right\}.$$
  What are the prime and maximal ideals?

Hi I asked a question with this set and I was wondering the prime and maximal ideals.
I remember seeing a theorem in a textbook that says that if $R$ is a commutative ring with identity, then the prime ideals are the maximal ideals.
So in this case, this set is a subring of $\mathbb{Q}$ so that means the prime ideals in this set are the maximal ideals, correct?
So the definition of a prime ideal is that if we have $a,b \in R$, if $ab \in P$ then $a\in P$ or $b \in P$.
So what I started with was, suppose that $P$ is a prime ideal for $\mathbb{Z}[\frac{1}{n}]$. Let $\frac{a}{n^r}, \frac{b}{n^s} \in \mathbb{Z}[\frac{1}{n}]$. 
Suppose that: $\frac{ab}{n^{r+s}} \in P$, that means $\frac{a}{n^r} \in P$ or $\frac{b}{n^s} \in P$. 
But I'm stuck here. Any tips or hints to progress further?
 A: First of all, as  Zhen Lin observed, a prime ideal is not necessary maximal. Think to the ideal $(p) \subseteq \mathbb{Z}[x]$.
We can ask if this holds in some particular categories of rings.
It is not true if we chose UFD rings, in fact $\mathbb{Z}[x]$ is UFD and we have ever seen a counterexample.
The assert is true for the PID Rings with only one exception: every non zero prime is maximal!(otherwise, if the $(0)$ ideal is prime the ring is a field...)
Now, your ring is the localization  $S^{-1}\mathbb{Z}$ for the multiplicative set $S=\{n^i | i >0\}$.
Holds the following 
Proposition Let $R$ be a ring and $S$ a multiplicative set of $R$. Then there's a bijection between the primes $Q$ of $S^{-1}R$ and the primes $P$ of $R$ such that $P \cap S = \emptyset$
This proposition is easy to prove and you can find it in any introductive book of Commutative Algebra. The idea is that, if an ideal $I$ meets $S$, its image in $S^{-1}R$ contains an invertible element and then is equal to all $S^{-1}R$.
Now we come to your question: what about the maximal ideals of $S^{-1}\mathbb{Z}$ fwhere $S=\{n^i | i >0\}$?
Well, the primes are all images of the prime ideals $P$ of $\mathbb{Z}$ such that $n^i \notin P$ 
The ideals of this forms are the image of $(0)$ or all the images of the ideals $(q)$ where $q$ is not a prime factor of $n$.
Which of this are maximals? 
Answer: every image of a non zero prime of $\mathbb{Z}$ as above. 
There are a lot of metods to prove this, my favourite uses the following
Theorem If $0 \rightarrow I \rightarrow R \rightarrow R/I \rightarrow 0$ is an exact sequence and $S$ is a multiplicative subset of $R$, then  $0 \rightarrow S^{-1}I \rightarrow S^{-1}R \rightarrow S^{-1}(R/I) \rightarrow 0$
Now you can easily prove that the ideals of the form above are maximal observing that $$ S^{-1}R /S^{-1}I \simeq S^{-1}(R/I) $$.
A: Sketch for a low-tech solution: show $\Bbb Z[\frac{1}{n}]$ is a PID ($\Leftarrow$ every ideal $(a,b)$ is principal $\Leftarrow \Bbb Z$ is a PID) and irreducibles $\pi\in\Bbb Z[\frac{1}{n}]$ are associate to irreducibles $p\in\Bbb Z$ (but which $p$ are units in $\Bbb Z[1/n]$?).
