refactor the Miller-Rabin test code
refactor the Miller-Rabin test code

also use pow(b, 2, n) rather than b**2 % n which is a bit more efficient

cswiercz/sympy,aktech/sympy,skidzo/sympy,sahilshekhawat/sympy,MechCoder/sympy,oliverlee/sympy,shikil/sympy,Designist/sympy,rahuldan/sympy,souravsingh/sympy,Mitchkoens/sympy,wanglongqi/sympy,Arafatk/sympy,kmacinnis/sympy,kaichogami/sympy,Mitchkoens/sympy,dqnykamp/sympy,mcdaniel67/sympy,sunny94/temp,lidavidm/sympy,sunny94/temp,lindsayad/sympy,postvakje/sympy,vipulroxx/sympy,hargup/sympy,bukzor/sympy,moble/sympy,maniteja123/sympy,postvakje/sympy,liangjiaxing/sympy,jbbskinny/sympy,shikil/sympy,garvitr/sympy,oliverlee/sympy,meghana1995/sympy,Vishluck/sympy,farhaanbukhsh/sympy,MechCoder/sympy,meghana1995/sympy,hrashk/sympy,Titan-C/sympy,grevutiu-gabriel/sympy,asm666/sympy,AkademieOlympia/sympy,vipulroxx/sympy,sahmed95/sympy,kumarkrishna/sympy,Arafatk/sympy,chaffra/sympy,aktech/sympy,Gadal/sympy,beni55/sympy,pandeyadarsh/sympy,jamesblunt/sympy,kaushik94/sympy,cswiercz/sympy,moble/sympy,kaichogami/sympy,abloomston/sympy,skidzo/sympy,abhiii5459/sympy,madan96/sympy,cccfran/sympy,pandeyadarsh/sympy,beni55/sympy,kmacinnis/sympy,MridulS/sympy,Titan-C/sympy,emon10005/sympy,asm666/sympy,Davidjohnwilson/sympy,wyom/sympy,farhaanbukhsh/sympy,sahilshekhawat/sympy,garvitr/sympy,Shaswat27/sympy,shipci/sympy,chaffra/sympy,kaushik94/sympy,jerli/sympy,jamesblunt/sympy,abhiii5459/sympy,lidavidm/sympy,Davidjohnwilson/sympy,shikil/sympy,AkademieOlympia/sympy,wyom/sympy,saurabhjn76/sympy,shipci/sympy,kmacinnis/sympy,Titan-C/sympy,hrashk/sympy,kevalds51/sympy,kaushik94/sympy,oliverlee/sympy,cccfran/sympy,Curious72/sympy,farhaanbukhsh/sympy,debugger22/sympy,dqnykamp/sympy,lidavidm/sympy,hrashk/sympy,aktech/sympy,VaibhavAgarwalVA/sympy,MechCoder/sympy,souravsingh/sympy,maniteja123/sympy,garvitr/sympy,emon10005/sympy,ahhda/sympy,ga7g08/sympy,mafiya69/sympy,Gadal/sympy,Sumith1896/sympy,yashsharan/sympy,cccfran/sympy,liangjiaxing/sympy,dqnykamp/sympy,AunShiLord/sympy,bukzor/sympy,postvakje/sympy,drufat/sympy,abloomston/sympy,madan96/sympy,Arafatk/sympy,meghana1995/sympy,Vishluck/sympy,atreyv/sympy,wanglongqi/sympy,hargup/sympy,liangjiaxing/sympy,yukoba/sympy,Gadal/sympy,jbbskinny/sympy,ChristinaZografou/sympy,jaimahajan1997/sympy,moble/sympy,sahilshekhawat/sympy,diofant/diofant,mafiya69/sympy,Designist/sympy,Shaswat27/sympy,Vishluck/sympy,iamutkarshtiwari/sympy,ahhda/sympy,hargup/sympy,pbrady/sympy,sampadsaha5/sympy,kevalds51/sympy,toolforger/sympy,yashsharan/sympy,madan96/sympy,lindsayad/sympy,atreyv/sympy,Shaswat27/sympy,AkademieOlympia/sympy,Mitchkoens/sympy,Curious72/sympy,jbbskinny/sympy,atsao72/sympy,jerli/sympy,pbrady/sympy,MridulS/sympy,rahuldan/sympy,ga7g08/sympy,atsao72/sympy,rahuldan/sympy,vipulroxx/sympy,sahmed95/sympy,wyom/sympy,iamutkarshtiwari/sympy,souravsingh/sympy,beni55/sympy,ChristinaZografou/sympy,pbrady/sympy,drufat/sympy,yukoba/sympy,saurabhjn76/sympy,toolforger/sympy,mcdaniel67/sympy,jaimahajan1997/sympy,saurabhjn76/sympy,sampadsaha5/sympy,kaichogami/sympy,lindsayad/sympy,debugger22/sympy,sunny94/temp,shipci/sympy,chaffra/sympy,jerli/sympy,kumarkrishna/sympy,ChristinaZografou/sympy,Sumith1896/sympy,drufat/sympy,kevalds51/sympy,cswiercz/sympy,yukoba/sympy,grevutiu-gabriel/sympy,skirpichev/omg,kumarkrishna/sympy,wanglongqi/sympy,skidzo/sympy,ahhda/sympy,emon10005/sympy,atsao72/sympy,MridulS/sympy,atreyv/sympy,asm666/sympy,grevutiu-gabriel/sympy,iamutkarshtiwari/sympy,maniteja123/sympy,jamesblunt/sympy,sahmed95/sympy,Davidjohnwilson/sympy,bukzor/sympy,mafiya69/sympy,toolforger/sympy,abhiii5459/sympy,jaimahajan1997/sympy,VaibhavAgarwalVA/sympy,mcdaniel67/sympy,Curious72/sympy,pandeyadarsh/sympy,sampadsaha5/sympy,ga7g08/sympy,Sumith1896/sympy,Designist/sympy,AunShiLord/sympy,abloomston/sympy,AunShiLord/sympy,VaibhavAgarwalVA/sympy,debugger22/sympy,yashsharan/sympy