# Does $a = 0$ iff $a \equiv 0 \ (\operatorname{mod} p)$ for every prime $p$?

Suppose $a \in \mathbb{Z}$. Does $a = 0$ iff $a \equiv 0 \ (\operatorname{mod} p)$ for every prime $p$?

It's probably a silly question, but I don't know how to go about it. I'm motivated by the common contest math trick of considering a Diophantine equation $\operatorname{mod} p$. By naturality of $\mathrm{eval}_{x}: (-[t]) \to \mathrm{id}_{\mathbf{CRing}}$ the above question is at least as strong as the following:

Is an integer a root of a diophantine equation iff it is a root of the said equation mod every prime number?

It's also cool that this question is equivalent to the following:

Are functions on $\operatorname{Spec} \mathbb{Z}$ completely defined by their values on points of the underlying topological space?

I don't know how to approach this question, but I'd be grateful for an answer or a hint (if it's not much harder than a typical exercise in an abstract algebra textbook).

-
If $a\in \mathbb Z \setminus \{0\}$, choose a prime $p$ with $0 < |a| < p$. Then $a \not\equiv 0 \pmod p$. – martini Oct 28 '12 at 8:34
@martini Ah, this reminds me of how integers are encoded in computers :) Thank you! – Alexei Averchenko Oct 28 '12 at 8:37
I guess you really balcked out here - I wonder how one can know what Spec is without noticing martini's observation. :) – Hagen von Eitzen Oct 28 '12 at 8:57
@Hagen I'm weird :D – Alexei Averchenko Oct 28 '12 at 9:07
Fun, related fact: en.wikipedia.org/wiki/Carmichael_number – Per Alexandersson Oct 28 '12 at 17:38

Since you mentioned $\text{Spec}$, the appropriate generalization to arbitrary commutative rings is the following: an element of a commutative ring $R$ is completely determined by its value mod all prime ideals $P$ if and only if $R$ has trivial nilradical (hence is a reduced ring), and is completely determined by its value mod all maximal ideals $m$ if and only if $R$ has trivial Jacobson radical (hence is a semiprimitive or Jacobson semisimple ring).
An abstract form of the Nullstellensatz asserts that if $R$ is a Jacobson ring, then any finitely generated $R$-algebra is also a Jacobson ring. In a Jacobson ring, the nilradical and Jacobson radical coincide, so a Jacobson ring is reduced iff it is semiprimitive.