I have this way of testing for primes greater than 2.
I divide $2^{n-1} - 1$ by n. If the remainder is 0, n is a prime.
This works because in GF(p), if one multiplies all the non-zero elements in the field by the same non-zero number (say 2), all the numbers are simply reordered.
So, if one multiplies the products together, the product is the same as if one had not multiplied by the chosen field element. So, $2^{p-1}$ is congruent to 1 modulo p.
What I'm not sure about is the "only if". If p is prime $2^{p-1} - 1$ is congruent to 0 modulo p. However, it does not mean that if $2^{p-1} - 1$ is congruent to 0 modulo p, p is prime.
Can you help me come up with a proof of the "only if" part?
Incidentally, $2^{n-1} - 1$ is all 1's in binary.

$561 = 3\cdot 11\cdot 17$ is composite, but passes your test (and also passes it for any base other than $2$ as well).