[SinGuLaRiTy-1002] Miller Rabin Prime Judge 米勒·罗宾素数判定法
ByWenJian【背景】数论学家利用费马小定理研究出了多种素数测试办法,Miller-Rabbin素数测试算法是其中较快的一种。【步骤】(1)计算奇数M,使得N=2^r*M+1;(2)选择随机数A#include#includeusingnamespacestd;constintcount=10;intmodular_exp(inta,intm,intn){if(m==0)return1;if(