Let \(p\) be a composite number, then \(p\) can be written as \(ab\) where both \(a\) and \(b\) are greater than 1. So:
$$\begin{align} 2^p - 1 &= 2^{ab} - 1 \\ &= (2^a)^b - 1 \end{align}$$
We can rewrite this as:
$$(2^a)^b + \left( (2^a)^{b-1} - (2^a)^{b-1} \right) + \left( (2^a)^{b-2} - (2^a)^{b-2} \right) + \ldots + \left( (2^a)^1 - (2^a)^1 \right) - 1$$
We can put all the negatives in one side:
$$ \left( (2^a)^b + (2^a)^{b-1} + \ldots + (2^a) \right) - \left( (2^a)^{b-1} + \ldots + (2^a) + 1\right)$$
We can factor this:
$$ (2^a) \left( (2^a)^{b-1} + \ldots + (2^a) + 1 \right) - \left( (2^a)^{b-1} + \ldots + (2^a) + 1\right)$$$$ (2^a -1) \left( (2^a)^{b-1} + \ldots + (2^a) + 1 \right)$$
The above expression is a composite number. This means, if \(p\) is a composite number, then \(2^p - 1\) is also composite. The contrapositive of this would be "if \(2^p - 1\) is prime, then \(p\) is prime".