From the division algorithm, we know that:
a=bq+r
where \(r\) is the least positive residue of \(a \bmod b\). Since \(a=bq+r\), if we exponentiate both sides by 2 and then subtract one:
2^a -1=2^{bq+r}-1
We can rewrite this as:
\begin{gather} 2^a -1=(2^b-1)(2^{b(q-1)+r} + 2^{b(q-2)+r} + \cdots + 2^{b+r} + 2^r) + (2^r - 1)\\ 2^a -1 = (2^b-1)k + (2^r - 1) \end{gather}
This shows that when \(2^a -1\) is divided by \(2^b-1\), then the remainder is \(2^r - 1\).