<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Miller-Rabin素数测试 on 111qqz's blog</title><link>https://111qqz.com/en/tags/miller-rabin%E7%B4%A0%E6%95%B0%E6%B5%8B%E8%AF%95/</link><description>Recent content in Miller-Rabin素数测试 on 111qqz's blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2015-2026 111qqz</copyright><lastBuildDate>Tue, 17 Feb 2015 00:58:00 +0000</lastBuildDate><atom:link href="https://111qqz.com/en/tags/miller-rabin%E7%B4%A0%E6%95%B0%E6%B5%8B%E8%AF%95/index.xml" rel="self" type="application/rss+xml"/><item><title>hdu 2138 How many prime numbers</title><link>https://111qqz.com/en/post/acm-icpc/2015/2015-02-17-hdu2138/</link><pubDate>Tue, 17 Feb 2015 00:58:00 +0000</pubDate><guid>https://111qqz.com/en/post/acm-icpc/2015/2015-02-17-hdu2138/</guid><description>&lt;p&gt;ACM STEPS里的&amp;hellip;这题前面一道是求LCM&amp;hellip;.结果接下来就是这么一道。。。
朴素会超&amp;hellip;.筛法会爆&amp;hellip;.题目顺序真是按照难度来的？
于是想到 Miller-Rabin素数测试&amp;hellip;&amp;hellip;.
这个方法是基于费马小定理
我的理解就是&amp;hellip;
如果我要判断n是否为素数
只要取k个数 如果满足 a^(n-1)mod n =1 那么n就很可能为素数。
证明什么的&amp;hellip;暂时还是算了吧&amp;hellip;论文里貌似扯了一大堆
第一次用，竟然真的A了。。。。
感觉更好的办法也许是先打一个比较小的素数表，然后每次random选取若干个进行判断&amp;hellip;那样应该更可靠些？
本来想WA掉之后再改的。。。没想到这么写就A掉了。。。。杭电数据略水？&lt;/p&gt;</description></item></channel></rss>