Improve BigInt division and add prime test.