Definition of prime numbers and equivalence A prime number $p$ is a positive integer that has exactly two different dividers ($1$ and itself). This is a very clear and universal definition. 

My notes say that this definition is equivalent to the previous one: $p$ is a prime number if from $p \mid ab$ follows that $p \mid a$ or $p \mid b$ for $a,b \in \mathbb{Z}$. I was wondering why this is an equivalent definition for a prime number. 

Thanks in advance!
 A: Let $p$ be prime according to the first definition and let $p\nmid a$ and $p\nmid b$ where $a$ and $b$ are positive integers.
It is well known that there are unique expressions $a=r_1^{u_1}\cdots r_n^{u_n}$ and $b=s_1^{v_1}\cdots s_m^{v_m}$  where the $s_i$ and $r_j$ are primes according to the first definition and the $u_i$ and $v_j$ are positive integers.
Then from $p\nmid a$ and $p\nmid b$ it follows that $p\notin\{r_1,\dots, r_n,s_1,\dots, s_n\}$ which is evidently the set of prime factors of $ab$. So we conclude that $p\nmid ab$.
Proved is now that a prime according to the first definition is also a prime according to the second definition.
For the converse see the answer of greedoid.

Formally the first definition states that $p$ is irreducible and the second that $p$ is prime. Every prime $p$ is irreducible and in the special case of the ring of integers the concepts irreducible and prime coincide. But in a more general setting an irreducible element of a ring is not necessarily prime. So actually prime is stronger than irreducible.
A: Suppose there is positive not prime $n$ such that $$n \mid ab\implies  n \mid a \;\;\;{\rm or}\;\;\; n \mid b$$ for $a,b \in \mathbb{Z}$.
Then $n= x\cdot y$ and $xy\ne 1$, so $n\mid xy$  and thus $n\mid x$ or $n\mid y$. 
But $x,y<n$ so we have a cotnradiction.

The other way is well known fact in number theory.
