As this is related to Mersenne numbers, let's turn it into an exercise for anyone interested.

1. Show for all positive integers m,n that if m divides n then \(2^m-1\) divides \(2^n-1\).

Let q be an odd prime number.

2. Show for all positive integers m,n with m>n that if q divides \(2^m-1\) and q divides \(2^n-1\) then q divides \(2^{m-n}-1\).

Let p be an odd prime number as well and suppose that q divides \(2^p-1\).

3. Show for all positive integers n that q divides \(2^n-1\) if and only if p divides n.

4. Conclude that \(q\equiv 1\pmod{p}\).

5. Show that 2 is a square in the integers modulo q, and conclude that \(q\equiv\pm1\pmod{8}\).

For the last part, the first example

here may be useful.