Factor of Mersenne Number

Theorem
Let $p$ and $q$ be prime numbers such that $p$ is a divisor of the Mersenne number $M_q$.

Then both of these properties apply:
 * $p \equiv 1 \pmod q$
 * $p \equiv \pm 1 \pmod 8$

Proof
Suppose $p \mathop \backslash M_q$.

Then:
 * $2^q \equiv 1 \pmod p$

From Integer to Power of Multiple of Order, the multiplicative order of $2 \pmod p$ divides $q$.

By Fermat's Little Theorem, the multiplicative order of $2 \pmod p$ also divides $p - 1$.

Hence:
 * $p - 1 = 2 k q$

and so:
 * $p \equiv 1 \pmod q$

Also, from above:
 * $2^{\left({p-1}\right)/2} \equiv 2 q k \equiv 1 \pmod p$

and so $2$ is a quadratic residue $\pmod p$.

From Second Supplement to Law of Quadratic Reciprocity:
 * $p \equiv \pm 1 \pmod 8$

Historical Note
This proof was originally provided by.