08 2015 档案

分解质因数
摘要:1 # include 2 # include 3 # include 4 # include 5 # include 6 using namespace std; 7 int ans[205]; 8 void just_do() 9 {10 mapm;11 map::iterat... 阅读全文

posted @ 2015-08-04 14:22 20143605 阅读(13187) 评论(0) 推荐(3)

Miller Rabbin (判断大素数)
摘要:费马小定理:a为整数,n是素数,且a,n互质,则有a^(n-1)≡1(mod n) ,即:a^(n-1)模n得1。快速判定一个数是否为素数的方法:如果存在一个整数a,使得a^(n-1)≡1(mod n) ,则称n为基于a的伪素数,当有多个满足关系的a时,则n为素数的概率趋向于1。所以取多个a测试一下... 阅读全文

posted @ 2015-08-03 14:12 20143605 阅读(2932) 评论(0) 推荐(0)