Optimized a bit
Use the Miller–Rabin primality test in some solutions. Code taken from
http://en.literateprograms.org/index.php?title=Special:DownloadCode/Miller-Rabin_primality_test_%28Python%29&oldid=17104