摘要: GCD Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description The greatest common divisor GCD(a,b) of two p 阅读全文
posted @ 2016-05-07 20:45 jhz033 阅读(190) 评论(0) 推荐(0)
摘要: Longge's problem Description Longge is good at mathematics and he likes to think about hard mathematical problems which will be solved by some gracefu 阅读全文
posted @ 2016-05-07 19:42 jhz033 阅读(165) 评论(0) 推荐(0)
摘要: 判断一个素数是否为素数: 1:2-n-1。。。for暴力判断; 2:sqrt(n) 判断; 3:一个我也不知道为什么的代码,总之蛮快的 4:判断一个大素数的米勒拉宾素数测试 复杂度:O(k*log(n))k是测试的次数 素数打表: 1 埃拉特斯特尼筛法复杂度O(n loglog(n)); 2 欧拉筛 阅读全文
posted @ 2016-05-07 11:21 jhz033 阅读(296) 评论(0) 推荐(0)
摘要: 首先需要知道两个定理: 1: 费马小定理: 假如p是素数,且gcd(a,p)=1,那么 a(p-1)≡1(mod p)。 2:二次探测定理:如果p是素数,x是小于p的正整数,且,那么要么x=1,要么x=p-1。 证明:这是显然的,因为相当于p能整除,也即p能整除(x+1)(x-1)。 由于p是素数, 阅读全文
posted @ 2016-05-07 10:47 jhz033 阅读(553) 评论(0) 推荐(0)