Affine scheme $X$ with $\dim(X)=0$ but infinitely many points

As the title says, I'm looking for an affine scheme of dimension zero, but with infinitely many points. At first I doubted that something like this could exist, and I still can't think of an example, but I'm beginning to think there must be one.

Such a scheme corresponds to a zero-dimensional ring $A$ of Krull dimension $0$, i.e. the only 'chains' of prime ideals in $A$ have to be the prime ideals themselves. If $k$ is a field, I could take $n$-fold product $k^n=k\times...\times k$. The prime ideals in $k^n$ are exactly those of the form $k\times...\times\langle0\rangle\times...\times k$, with the $\langle0\rangle$ at any position. Hence in $k^n$ there are no chains of prime ideals of length greater than $0$. But of course we only have finitely many (namely, $n$) points. Is it possible to carry this construction over to an infinite product of copies of $k$?

Take for example $k^\mathbb{N}$, which is a countable product of copies of $k$. At first I thought this was just $k[[x]]$, but the ring structure is not the same. Wikipedia states that in such an infinite product there exist ideals which are not of the type $\prod_{n\in\mathbb{N}}I_n$. An example is the ideal $I$ of elements of $k^\mathbb{N}$ with only finitely many non-zero components.

Although having an infinite indexing set, products of ideals of $k$ that contain only one factor $\langle 0\rangle$ are still prime, so we have infinitely many points in $\operatorname{Spec}(k^\mathbb{N})$. But what about the dimension? There exist other prime ideals, so I'm not sure how to go on about that. Does $k^\mathbb{N}$ work at all, or are there other - maybe simpler - examples? Or even none?

EDIT: In case of an infinite product of rings $A_i$, does the spectrum of $\prod_i A_i$ still correspond to some disjoint union of schemes? In my case, geometrically thought: by taking one more copy of $k$ into the product, we are adding a new point to our affine scheme. So from my intuition, the construction of $k^\mathbb{N}$ as an affine scheme with inf. many points and dimension $0$ should be working.

The rest of the exercise (Find examples or prove there are none. A short check if what I write is correct would be very kind):

1. An affine scheme $X$ with $\dim(X)=1$ and exactly one point.
2. An affine scheme $X$ with $\dim(X)=1$ and exactly two points.

As for 1: This should not be possible, since exactly one point means there is just one prime ideal, so the dimension of $X$ will be $0$.

2: $k[[x]]$ should work here, as well as any discrete valuation ring (not a field).

-
No, the disjoint union of infinitely many affine schemes fails to be affine. For one thing, every affine scheme is quasicompact, but any infinite disjoint union is not. (In more sophisticated terms: the embedding $\textbf{CRing}^\textrm{op} \to \textbf{Sch}$ only preserves finite coproducts.) – Zhen Lin Mar 10 '12 at 12:09
Your answer to 2 is correct. Your answer to 1 is also correct. Here are some simple exercises. Let $X$ be a scheme which is a (finite or not!) disjoint union of open subschemes $X_i$. Then $\mathcal{O}_X(X) \cong \prod_i\mathcal{O}_X(X_i)$. Moreover, any scheme of finite cardinal and dimension $0$ is affine and has the trivial topology (i.e., every point is open). – seporhau Mar 10 '12 at 13:09
There do exist examples. Consider the ring of locally constant functions on a compact and totally disconnected topological space, and taking values in any fixed field. Its prime ideals correspond to the points of the topological space. I'm sure I posted this example either here or on mathoverflow, I'll check... – George Lowther Mar 10 '12 at 13:36
Here it is, mathoverflow.net/questions/79264/… – George Lowther Mar 10 '12 at 14:01

There is a complete characterization of affine schemes $X=Spec(A)$ of dimension zero.

First, we may assume that the ring $A$ is reduced (i.e. that its only nilpotent is zero), because $A$ and $A_{red}=A/Nil(A)$ have homeomorphic spectra so that $dimSpec (A)=dimSpec (A_{red})$.

Then for a reduced ring $A$ and its associated affine scheme $X=Spec(A)$ the following statements are equivalent:
1. $X$ has dimension zero
2. Every localization $A_\mathfrak p \;(\mathfrak p\in X)$ is a field.
3. $A$ is von Neumann regular i.e.$\forall a\in A \;\;\exists b\in A$ with $a=ba^2$

It is very easy to use the von Neumann property and thus to build many examples of affine schemes of dimension zero.
For example any product of von Neumann regular rings is von Neumann regular and obviously a field is von Neumann regular, hence a completely arbitrary product of fields $A= \Pi_{i\in I}k_i$ has zero dimensional spectrum $Spec(A)$.
Note that already $Spec(k^{\mathbb N})$ is homeomorphic to the Stone-Čech compactification of $\mathbb N$ and has cardinality $2^{\mathfrak c}=2^{2^{\aleph_0}}$ but dimension zero.

Edit
By a happy coincidence our friend George Lowther has given us a link (in a comment to the question) to his answer on MathOverflow, which nicely illustrates the above ( George gives a different argument, not using von Neumann regularity ).

He considers a field $k$, a compact Hausdorff space $T$ and the ring $A\subset k^T$ of locally constant functions $f: T\to k$.
It is clear that $A$ is reduced, and trivial to see that it is von Neumann regular:
Indeed every $f\in A$ can be written $f=g\cdot f^2$ where we define $g$ by $g(t)=1/f(t)$ if $f(t)\neq0$ and by $g(t)=0$ if $f(t)=0$.
The function $g$ is clearly in $A$ since it is exactly as locally constant as $f$.
Hence $X=Spec(A)$ is always zero-dimensional and $X$ will be infinite as soon as $T$ has infinitely many open connected components, since the locally constant functions vanishing on one such connected component $U$ constitute a maximal ideal $\mathfrak m_U$.
George suggests taking for $T$ the one point compactification of the discrete space $\mathbb N$

Second Edit
seporhau, in a comment below, asks the interesting question: if $A=\Pi_{i\in I}A_i$ with $I$ arbitrary and all $A_i$'s zero-dimensional, may we conclude that $A$ is zero-dimensional?
The answer is yes if all the $A_i$'s are reduced, thanks to the equivalence above since in the reduced case the $A_i$'s must be von Neumann regular.
If the $A_i$'s are not reduced, however, the answer may be no:

I claim that the ring $A=\Pi_{n=1}^\infty \mathbb Z/2^n\mathbb Z$ is not zero-dimensional although all $\mathbb Z/2^n\mathbb Z$ are.
Indeed the Jacobson radical of $A$ is $Jac(A)=\Pi Jac(\mathbb Z/2^n\mathbb Z)=\Pi (2\mathbb Z/2^n\mathbb Z)$ and contains the sequence $(2,2,\cdots)$, whereas its nilradical does not contain that sequence.
This proves that $A$ does not have dimension zero, because in a zero-dimensional ring the Jacobson radical equals the nilradical.

Third edit
I have just learned on MathOverflow that $dim(\Pi_{n=1}^\infty \mathbb Z/2^n\mathbb Z)= \infty$

-
Let $A$ be a (finite or not) product of zero-dimensional rings. Do I correctly understand that the statement "the product of von Neumann regular rings is von Neumann regular" implies that the dimension of $\mathrm{Spec}\ A$ is zero? – seporhau Mar 10 '12 at 20:08
Dear @seporhau, I have answered your very interesting question in a second Edit to my answer. – Georges Elencwajg Mar 10 '12 at 21:29
Thank you very much!! The importance of reducedness becomes clear now. – seporhau Mar 10 '12 at 22:02
As another argument, I think it suffices to note that the ring $A$ in your edit contains the ring of $2$-adic integers. Therefore, the spectrum of $A$ surjects onto the spectrum of the ring of $2$-adic integers. Thus, it has dimension at least $1$. – seporhau Mar 10 '12 at 22:06
Dear @seporhau, I'd be very careful with that kind of argument: for example the ring $\mathbb Z$ is a subring of the ring $\mathbb Q$ but the associated morphism $Spec (\mathbb Q) \to Spec (\mathbb Z)$ is not surjective and $Spec (\mathbb Q)$ has dimension zero . – Georges Elencwajg Mar 10 '12 at 23:15