Update base.py

Changed the Miller-Rabin primality test to the Baillie-PSW primaility test. Updated a few code pieces in mulinv(x, mod).