TITLE: Are the p-adics a direct summand of the direct product of the groups $\mathbb{Z}/p^n\mathbb{Z}$?
QUESTION [23 upvotes]: The p-adic integers $\mathbb{Z}_p$ can be thought of as a subgroup of the direct product group $P = \prod_{n \geq 1} \mathbb{Z}/p^n\mathbb{Z}$.  Are they a direct summand of this group? That is, is the inclusion $\mathbb{Z}_p \hookrightarrow P$ split?

REPLY [11 votes]: Let me give a bit of an algebro-geometric perspective on Will's excellent answer, which I note gives not just a splitting of abelian groups but actually a ring homomorphism as well.  Let's write $R=\prod \mathbb{Z}/p^n$ and try to understand $\operatorname{Spec} R$.  Suppose we have a field $k$ and a homomorphism $f:R\to k$.  For any subset $A\subseteq \mathbb{N}$, let $1_A\in R$ be the element that is $1$ on coordinates in $A$ and $0$ on other coordinates.  This element is an idempotent, so $f(1_A)$ must be $0$ or $1$.  If we write $U$ for the set of all $A$ such that $f(1_A)=1$, then it is easy to see that $U$ is an ultrafilter.
This defines a continuous map $\operatorname{Spec} R\to \beta\mathbb{N}$, where $\beta\mathbb{N}$ is the space of all ultrafilters on $\mathbb{N}$.  The fiber over any principal ultrafilter is easily seen to be a single point, corresponding to the projection from $R$ to a single coordinate followed by the quotient map to $\mathbb{F}_p$.  Over a nonprincipal ultrafilter $U$, the fiber can be identified with $\operatorname{Spec} R_U$, where $R_U$ is the quotient of $R$ by the elements $1-1_A$ for $A\in U$; alternatively, $R_U$ is the ultraproduct $\prod_U \mathbb{Z}/p^n$.  For any $n$, the canonical map $\mathbb{Z}/p^n\to R_U/p^n$ is an isomorphism (because this property can be expressed in the first-order theory of rings and is true on all sufficiently large coordinates of the product), and so there is a unique map $R_U\to \mathbb{Z}_p$.  This map is exactly the splitting which Will describes in his answer, and this shows that Will's splittings are the only possible splittings which are ring homomorphisms.  In particular, it is surjective, so we obtain a canonical copy of $\operatorname{Spec} \mathbb{Z}_p$ as a closed subset of the fiber over each nonprincipal ultrafilter $U$.
Note, however, that $\operatorname{Spec} R_U$ is a lot larger than $\operatorname{Spec}\mathbb{Z}_p$.  In particular, the kernel of the map $R_U\to \mathbb{Z}_p$ includes all elements such that the divisibility of their coordinates by $p$ goes to infinity with respect to $U$.  Any such element for which the divisibility goes to infinity slower than $n^{1/k}$ for all $k$ will be non-nilpotent, and in fact it is not hard to construct uncountably many prime ideals in $R_U$ corresponding to different rates of convergence to infinity (compare with my example at the end of this answer).  However, we can at least say that every prime ideal of $R_U$ either comes from $\mathbb{Z}_p$ or is contained in the kernel of $R_U\to\mathbb{Z}_p$: any element not in the kernel is of the form $p^nu$ where $u$ is a unit, and $p$ generates the unique maximal ideal of $R_U$.