Note that to calculate e.g., 232 you don't need to do 31 multiplications. 5 is enough.
<br />
\begin{align*}<br />
&2^2=4,\\<br />
&2^4=4^2=16,\\<br />
&2^8=16^2=256,\\<br />
&2^{16}=256^2=65536,\\<br />
&2^{32}=65536^2=4294967296.<br />
\end{align*}<br />
To calculate 2(m-1) will require on the order of log(m) multiplications and additions. As you only need to do it modulo n, the multiplications are done on numbers no bigger than n.
Multiplying two numbers of size about n requires log(n)2 operations using the normal method of multiplication that you learn as a kid, because they will have log(n) digits.
However, Fast Fourier Transforms can improve this to log(n)log(log(n)).
Altogether, this gives a time on the order of log(n)2log(log(n)) to calculate 2n-1 modulo n.
However, does this really work as a primality test?
edit: it doesn't. Just tried some examples and got 561 = 3 * 11 * 17 is not prime, but 2560=1 (mod 561).