Added fast modular exponentiation to sympy.ntheory.primtest.py

I've improved the code quality and all the tests have now passed. Please check it out and let me know. Thank you!