TITLE: Alternate definition of prime number
QUESTION [10 upvotes]: I know the definition of prime number when dealing with integers, but I can't understand why the following definition also works:

A prime is a quantity $p$ such that whenever $p$ is a factor of some product $a\cdot b$, then either $p$ is a factor of $a$ or $p$ is a factor of $b$.

For example, take $4$ (which clearly is not a prime): it is a factor of $16=8\cdot 2$, so I should check that either $4\mid 8$ or $4\mid 2$. But $4\mid 8$ is true. So $4$ is a prime, which is absurd.
Please note that English is not my first language, so I may have easily misunderstood the above definition.
Edit: Let me try formalize the definition as I understood it: $p$ is prime if and only if $\exists a\exists b(p\mid a\cdot b)\rightarrow p\mid a\lor p\mid b$.

REPLY [6 votes]: You have encountered the general ring-theoretic definition of a prime (versus irreducible) element. For general rings one distinguishes between the inequivalent properties of being irreducible, i.e. having no nontrivial factors, and being prime, i.e a nonunit such that if it divides a product then it divides some factor of the product. The latter property is key to the uniqueness of factorizations into irreducibles since one easily proves by induction that products of primes factor uniquely in any domain (i.e. a ring such that $\rm\; ab = 0 \;\Rightarrow\; a=0\ \  or\ \ b=0)$.
Here are the precise definitions. Let $\rm\; a,b,p \;$ be elements of a domain $\rm\,Z$.
Definition $\rm\ \ \; a\;$ is a unit (invertible)$\ \ $ if $\rm\ \ a\: |\: 1\ \ \:\; [recall \ \:a\ |\ b\ :=\ a\ \ divides\ \ b\:]$
Definition $\ \ $ nonunit $\rm\; p\;$ is $\quad\;$ prime $\quad\;$ if $\;\;\;\rm p\ \mid\ ab \;\;\Rightarrow\;\; p\mid a \;\;\; or \;\;\; p\mid b$
Definition $\ \ $ nonunit $\rm\; p\;$ is $\:$ irreducible$\;$ if $\;\;\:\rm p = ab \;\;\Rightarrow\;\; p\mid a \;\;\; or \;\;\; p\mid b\ \ $ (a.k.a.$\:$ atom)
Corollary $\ \ \;$ prime $\;\;\Rightarrow\;\;$ irreducible, $\ $ since $\;\;\;\rm p = ab \;\;\Rightarrow\;\; p\mid ab$
Conversely $\:$ irreducible $\;\Rightarrow\;\;$ prime $\;\;$ iff $\;$ factorizations into irreducibles are unique (up to order and units). Indeed, it is very easy to prove that a factorization into primes is unique, i.e. any other factorization into irreducibles is the same (up to order and units), as in the classical proof of the Fundamental Theorem of Arithmetic.
A common equivalent definition of an irreducible  is a nonunit with only trivial (unit) factors
Definition $\ \ $ nonunit $\rm\; p\;$ is $\:$ irreducible$\;$ if $\;\;\:\rm p = ab \;\;\Rightarrow\;\; a\mid 1 \;\;\; or \;\;\; b\mid 1\ \ $
To see this definition is equivalent to that above simply observe that
If $\rm \ p = ab\,$ then $\, \dfrac{a}p = \dfrac{1}b\ $ so $\ p\mid a\iff b\mid 1\iff b=1.\,$ Similarly $\,\rm p\mid b\iff a = 1,\,$ hence combining the two we infer that $\ p\mid a\,$ or $\,p\mid b\iff b=1\,$ or $\,a=1$.