<s>[INST] How to prove or disprove $n$ is prime? Let $n$ be an odd number such that
$$2^{\frac{n-1}{2}}\equiv -1 \pmod{n}$$
How do I prove or disprove $n$ must is prime? 
This problem is from when I solved another problem. Thank you 
 [/INST] The basic method for fast exponentiation is to first find the base 2 expansion of $1638$, i.e., notice that $1638=2+2^2+2^5+2^6+2^9+2^{10}$.
On the other hand, $2^2\equiv 4 \pmod{3277}$, $2^{2^2}\equiv 16 \pmod{3277}$, $2^{2^3}\equiv 256 \pmod{3277}$ and $2^{2^4}\equiv -4 \pmod{3277}$, $2^{2^5}\equiv 16 \pmod{3277}$, $2^{2^6}\equiv 256 \pmod{3277}$, $2^{2^7}\equiv -4 \pmod{3277}$, $2^{2^8}\equiv 16 \pmod{3277}$, $2^{2^9}\equiv 256 \pmod{3277}$, $2^{2^{10}}\equiv -4 \pmod{3277}$. Note that to get each term, I'm just squaring the previous term, so this is a pretty quick calculation.
Therefore, $2^{1638}\equiv 2^{2+2^2+2^5+2^6+2^9+2^{10}}\equiv (4)(16)(16)(256)(256)(-4)\equiv -1 \pmod{3277}$.
</s>