# Prime iff Equal to Product

## Theorem

Let $p \in \Z$ be an integer such that $p \ne 0$ and $p \ne \pm 1$.

Then $p$ is prime if and only if:

$\forall a, b \in \Z: p = ab \implies p = \pm a \lor p = \pm b$

## Proof

### Necessary Condition

Let $p$ be a prime number.

Then by definition, the only divisors of $p$ are $\pm 1$ and $\pm p$.

Thus, if $p = a b$ then either $a = \pm 1$ and $b = \pm p$ or $a = \pm p$ and $b = \pm 1$.

$\Box$

### Sufficient Condition

Suppose that:

$\forall a, b \in \Z: p = a b \implies p = \pm a \lor p = \pm b$

This means that the only divisors of $p$ are $\pm 1$ and $\pm p$.

That is, that $p$ is a prime number.

$\blacksquare$