The local ring $(R,\mathfrak{m})$ contains a field if and only if $\mathrm{char}(R) = \mathrm{char} (R/\mathfrak{m})$. I'm trying to prove that a local ring $(R,\mathfrak{m})$ contains a field if and only if $\mathrm{char}(R)$ and $\mathrm{char} (R/\mathfrak{m})$ are equal. To this we must relate the characteristic of $R$ to the characteristic of it's residue field $K=R/\mathfrak{m}$. If $\mathrm{char}(K)=0$, then, $\mathrm{char}(R)=0$. So $R$ contains a copy of $\mathbb{Z}$. Now, since $R/\mathfrak{m}$ has characteristic $0$, none of the images of non-zero integers in $R$ can be in $\mathfrak{m}$, else their images in $R/\mathfrak{m}$ will be zero, contradicting $\mathrm{char}(K)=0$. Then by the universal property of localization, $R$ contains $\mathbb{Q}$.
Now for the converse, I know that if $\mathrm{char}(K)=p$, then $\mathrm{char}(R)$ is $0$ a power of $p$, but I don't know how to completely prove this part. Why can't the characteristic be some non-prime integer? And furthermore, why can't $R$ contain a field in any case besides when $\mathrm{char}(R)= p$?
 A: The reason the characteristic of the local ring $R$ will be a prime power if it is not equal to $0$ is that the maximal ideal must contain all zero divisors (consider the image of a zero divisor in $R/\mathfrak{m}$ since the maximal ideal in a local ring contains all nonunits). If the characteristic is $d=ab$, with $\gcd(a,b)=1$, then both $a$ and $b$ must lie in $\mathfrak{m}$, hence $1\in\mathfrak{m}$, which is impossible. Thus, the characteristic must be either $0$ or a prime power.
If $\mathrm{char}(R) = 0$ and $\mathrm{char}(K)=p\gt 0$, then $R$ cannot contain a field: if it contained one, the field would contain $1$, hence $\mathbb{Z}$, hence $\mathbb{Q}$, but then $p$ would be a unit lying in $\mathfrak{m}$, which is impossible.
If $\mathrm{char}(R) = p^m$, $m\gt 0$, and $\mathrm{char}(K)=p$, then $R$ cannot contain a field: the field would necessarily contain $1$ and be of characteristic $p$ (since the characteristic of a subring must divide the characteristic of the ring), but then the subring generated by $1$ would be $\mathbb{Z}/p\mathbb{Z}$; however, the condition that $\mathrm{char}(R)=p^m$ means that the additive order of $1$ in $R$ is $p^m$, which shows $R$ cannot contain a field.
Added. As pointed out in comments, in fact the field wold contain $1$, and hence be of the same characteristic as $R$ (since the characteristic equals the additive order of $1$).
A: The result you want is that $R$ contains a field $K$ iff $\operatorname{char}(R) = \operatorname{char}(R/\mathfrak{m}).$
$\implies$ If $K\subseteq R,$ then clearly $K$ and $R$ must have the same characteristic, as $1 + 1 + \dots + 1 = 0$ in $K$ if and only if $1 + 1 + \dots + 1 = 0$ in $R.$ Moreover, the composition $K\to R\to R/\mathfrak{m}$ gives a homomorphism of fields $K\to R/\mathfrak{m},$ so that $\operatorname{char}(R/\mathfrak{m}) = \operatorname{char}(K) = \operatorname{char}(R).$
$\impliedby$ Conversely, suppose $\operatorname{char}(R) = \operatorname{char}(R/\mathfrak{m}).$ There are two cases to consider.


*

*$\operatorname{char}(R) = \operatorname{char}(R/\mathfrak{m}) = 0:$ If the characteristic is $0,$ then every integer $n$ is invertible in $R$. Indeed, $n$ is invertible if and only if $n\not\in\mathfrak{m}.$ If $n\in\mathfrak{m},$ then $n = 0$ in $R/\mathfrak{m}.$ But this implies that $\operatorname{char}(R/\mathfrak{m})\mid n.$ Thus, there exists a map $\phi : \Bbb Q = (\mathbb{Z}\setminus\{0\})^{-1}\Bbb Z\to R$ by the universal property of localization, which is necessarily an injection.

*$\operatorname{char}(R) = \operatorname{char}(R/\mathfrak{m}) = p:$ In this case, $R$ contains a copy of $\Bbb F_p.$ (Just map $\Bbb F_p\to R$ by $1\mapsto 1,$ and verify that this is a well-defined ring homomorphism and an injection.)

