<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cnPhil</title>
	<atom:link href="http://www.cnphil.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cnphil.com</link>
	<description>In Pursuit of Excellence</description>
	<lastBuildDate>Mon, 01 Mar 2010 06:59:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Go For Chefoo!</title>
		<link>http://www.cnphil.com/archives/195</link>
		<comments>http://www.cnphil.com/archives/195#comments</comments>
		<pubDate>Mon, 01 Mar 2010 06:59:17 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Informatics]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=195</guid>
		<description><![CDATA[新的征程馬上就要開始了, 為了我在芝罘的目標, 我需要從現在就開始行動.
以下借兩位神牛的話來勉勵自己:
往者不可諫，來者猶可追。
If you do it, you&#8217;ll have a chance, or you&#8217;ll never achieve your goal.
So. Do it NOW.
—— Sinya LEE.
Be confident, and you will win!
—— Chiapao KUO.
Random Posts

与 cnPhil.com 一起加入『地球一小时&#183;2009』行动
圣诞和美剧
Struggle For NOIp 2008!
OI 知识计划 · 2009
网络流知识讲解

]]></description>
			<content:encoded><![CDATA[<p>新的征程馬上就要開始了, 為了我在芝罘的目標, 我需要從現在就開始行動.</p>
<p>以下借兩位神牛的話來勉勵自己:</p>
<p>往者不可諫，來者猶可追。</p>
<p>If you do it, you&#8217;ll have a chance, or you&#8217;ll never achieve your goal.</p>
<p>So. <strong>Do it NOW</strong>.</p>
<p>—— Sinya LEE.</p>
<p>Be confident, and you will win!</p>
<p>—— Chiapao KUO.<br />
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/138" title="公开密钥的加密法: RSA加密算法">公开密钥的加密法: RSA加密算法</a></li>
<li><a href="http://www.cnphil.com/archives/20" title="NOIp 模拟测试解题报告（1）">NOIp 模拟测试解题报告（1）</a></li>
<li><a href="http://www.cnphil.com/archives/5" title="新三，新东方，新时代的开始！">新三，新东方，新时代的开始！</a></li>
<li><a href="http://www.cnphil.com/archives/73" title="NOI 2009 冬令营 · 笔记 (二)">NOI 2009 冬令营 · 笔记 (二)</a></li>
<li><a href="http://www.cnphil.com/archives/31" title="关于计算机科学的研究计划 &#8211; 两年">关于计算机科学的研究计划 &#8211; 两年</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/195/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>做数学与做学问</title>
		<link>http://www.cnphil.com/archives/186</link>
		<comments>http://www.cnphil.com/archives/186#comments</comments>
		<pubDate>Sun, 10 Jan 2010 06:43:40 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Informatics]]></category>
		<category><![CDATA[Trivia]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=186</guid>
		<description><![CDATA[看到Terence 老师在他的博客上写过一篇文章, “Does one have to be a genius to do maths”, Zhiqiang 老师评论说“他写这种文章是站着说话不腰疼.”
的确, 对于Terence老师这种12岁就获得国际数奥金牌的人来说, 天赋毫无疑问是他走向成功的一个因素. 但是, Terence老师下面这段话却发人深省:
In some cases, an abundance of raw talent may end up (somewhat perversely) to actually be harmful for one’s long-term mathematical development; if solutions to problems come too easily, for instance, one may not put as much energy [...]]]></description>
			<content:encoded><![CDATA[<p>看到<a href="http://zh.wikipedia.org/wiki/%E9%99%B6%E5%93%B2%E8%BD%A9">Terence 老师</a>在他的博客上写过一篇文章, “<a title="Terence" href="http://terrytao.wordpress.com/career-advice/does-one-have-to-be-a-genius-to-do-maths/">Does one have to be a genius to do maths</a>”, Zhiqiang 老师评论说“他写这种文章是站着说话不腰疼.”</p>
<p>的确, 对于Terence老师这种12岁就获得国际数奥金牌的人来说, 天赋毫无疑问是他走向成功的一个因素. 但是, Terence老师下面这段话却发人深省:</p>
<blockquote><p>In some cases, an abundance of raw talent may end up (somewhat perversely) to actually be <em>harmful</em> for one’s long-term mathematical development; if solutions to problems come too easily, for instance, one may not put as much energy into <a href="http://terrytao.wordpress.com/career-advice/work-hard/">working hard</a>, <a href="http://terrytao.wordpress.com/career-advice/ask-yourself-dumb-questions-%E2%80%93-and-answer-them/">asking dumb questions</a>, or <a href="http://terrytao.wordpress.com/career-advice/continually-aim-just-beyond-your-current-range/">increasing one’s range</a>, and thus may eventually cause one’s skills to stagnate.  Also, if one is accustomed to easy success, one may not develop the <a href="http://terrytao.wordpress.com/career-advice/be-patient/">patience</a> necessary to deal with truly difficult problems. Talent is important, of course; but how one develops and nurtures it is even more so.</p></blockquote>
<p>对应的译文: (来自<a href="http://liuxiaochuan.wordpress.com/2008/03/30/%E5%81%9A%E6%95%B0%E5%AD%A6%E4%B8%80%E5%AE%9A%E8%A6%81%E6%98%AF%E5%A4%A9%E6%89%8D%E5%90%97%EF%BC%9F-%EF%BC%88%E8%AF%91%E8%87%AA-%E9%99%B6%E5%93%B2%E8%BD%A9-%E5%8D%9A%E5%AE%A2%EF%BC%89/">LiuXiaochuan老师</a>)</p>
<blockquote><p>有的时候，大量的灵感和才智反而对长期的数学发展有害，试想如果在早期问题解决的太容易，一个人可能就不会刻苦努力，不会问一些“傻”的问题，不会尝试去扩展自己的领域，这样迟早造成灵感的枯竭。而且，如果一个人习惯了不大费时费力的小聪明，他就不能拥有解决真正困难的大问题所需要耐心，和坚韧的性格。聪明才智自然重要，但是如何发展和培养显然更加的重要。</p></blockquote>
<p>反过来想自己, 即使在创新能力要求极强的信息学中, 原来最重要的不是自己的那些灵光一闪的新点子, 而是严谨踏实的学术作风.<br />
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/55" title="Vote for Barack Obama">Vote for Barack Obama</a></li>
<li><a href="http://www.cnphil.com/archives/5" title="新三，新东方，新时代的开始！">新三，新东方，新时代的开始！</a></li>
<li><a href="http://www.cnphil.com/archives/119" title="Struggle For HNOI 2009!">Struggle For HNOI 2009!</a></li>
<li><a href="http://www.cnphil.com/archives/10" title="写在 Google 10岁时">写在 Google 10岁时</a></li>
<li><a href="http://www.cnphil.com/archives/90" title="OI Schedule · 2009">OI Schedule · 2009</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/186/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NOIp 2009 解题报告</title>
		<link>http://www.cnphil.com/archives/177</link>
		<comments>http://www.cnphil.com/archives/177#comments</comments>
		<pubDate>Thu, 26 Nov 2009 13:34:09 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Informatics]]></category>
		<category><![CDATA[NOI]]></category>
		<category><![CDATA[NOIp]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=177</guid>
		<description><![CDATA[以下是我的NOIp 2009 (提高组) 解题报告.
第一题(潜伏者, spy): 略.
第二题(Hankson 的趣味题, son): 
Gcd(x,a0)=a1, Gcd(x,b0)=xb0/b1
设f(a,b) 代表b这个质因子在a中有多少个.
对于a0的任意质因子t, 若f(a0,t)=f(a1,t) 则只需保证f(x,t)≥f(a1,t), 否则f(x,t)=f(a1,t)
对于b1的任意质因子t, 若f(b1,t)=f(b0,t) 则只需保证0≤f(x,t)≤f(b1,t), 否则f(x,t)=f(b1,t)
由于x的所有因子都是b1的子集, 所以我们只需对b1的质因子按如上方法逐个检查这个质因子在x里面的取值范围(若为空则说明无解), 并按照乘法原理统计即可.
关于分解质因子: 由于b1不会超过2*10^9, 大于50000的质因子不会超过1个, 所以我们只要打出50000以内的素数表即可, 若最后除剩的b1仍未除尽, 说明此时b1一定是一个大于50000的素数.
第三题(最优贸易, trade):
做法1:
设Low[i]为从1到i当前所有路径中最便宜的价格. Profit[i]为从1到i当前所有路径中最大获利. 初始时Low[1]=P[1], Low[2..n]=infinity, Profit[1..n]=0.
那么我们可以从1开始广搜, 要注意一个点有可能多次被更新.
从i可以更新到j的条件是:
1. 存在有向/无向边(i,j)
2. Low[j]&#62;Low[i] 或 Profit[j]&#60;Profit[i]
做法2:
首先考虑没有环的情况, 此时1,n之间要么无法连通, 要么只存在一些单向的无环路径. 对于每一条路径, 由于不能”回头”, 走到某个点i的极优获利显然是i的费用-路径上此点之前的点的最小费用, 而此路径的最大获利便是取获利最大的点.
但是还有很多数据是有环的, 也就是对于有些点对(a,b), 在a走到b之后, b仍然可以走回到a. 在图论中, 我们把点集V, 其中任意两个点可以互达, 叫做强连通分量.
由于强连通分量中的点可以互相到达, 所以在一个强连通中的最大获利就是强连通中最贵的-最便宜的. 我们把所有强连通分量求出来缩为两个点之后. 1与n之间只存在一些无环路径, 对于这些单向的无环路径我们只需要扫描一遍便可求出最大获利.
强连通缩为两个点的具体做法: 把一个强连通缩为a,b 两个点, 连(a,b)边, a的费用为强连通中最便宜的, [...]]]></description>
			<content:encoded><![CDATA[<p>以下是我的NOIp 2009 (提高组) 解题报告.</p>
<p><strong>第一题(</strong><strong>潜伏者, spy)</strong>: 略.</p>
<p><strong>第二题(Hankson </strong><strong>的趣味题, son): </strong></p>
<p>Gcd(x,a0)=a1, Gcd(x,b0)=xb0/b1</p>
<p>设f(a,b) 代表b这个质因子在a中有多少个.</p>
<p>对于a0的任意质因子t, 若f(a0,t)=f(a1,t) 则只需保证f(x,t)≥f(a1,t), 否则f(x,t)=f(a1,t)</p>
<p>对于b1的任意质因子t, 若f(b1,t)=f(b0,t) 则只需保证0≤f(x,t)≤f(b1,t), 否则f(x,t)=f(b1,t)</p>
<p>由于x的所有因子都是b1的子集, 所以我们只需对b1的质因子按如上方法逐个检查这个质因子在x里面的取值范围(若为空则说明无解), 并按照乘法原理统计即可.</p>
<p>关于分解质因子: 由于b1不会超过2*10^9, 大于50000的质因子不会超过1个, 所以我们只要打出50000以内的素数表即可, 若最后除剩的b1仍未除尽, 说明此时b1一定是一个大于50000的素数.</p>
<p><strong>第三题(</strong><strong>最优贸易, trade)</strong>:</p>
<p>做法1:</p>
<p>设Low[i]为从1到i当前所有路径中最便宜的价格. Profit[i]为从1到i当前所有路径中最大获利. 初始时Low[1]=P[1], Low[2..n]=infinity, Profit[1..n]=0.</p>
<p>那么我们可以从1开始广搜, 要注意一个点有可能多次被更新.</p>
<p>从i可以更新到j的条件是:</p>
<p>1. 存在有向/无向边(i,j)</p>
<p>2. Low[j]&gt;Low[i] 或 Profit[j]&lt;Profit[i]</p>
<p>做法2:</p>
<p>首先考虑没有环的情况, 此时1,n之间要么无法连通, 要么只存在一些单向的无环路径. 对于每一条路径, 由于不能”回头”, 走到某个点i的极优获利显然是i的费用-路径上此点之前的点的最小费用, 而此路径的最大获利便是取获利最大的点.</p>
<p>但是还有很多数据是有环的, 也就是对于有些点对(a,b), 在a走到b之后, b仍然可以走回到a. 在图论中, 我们把点集V, 其中任意两个点可以互达, 叫做强连通分量.</p>
<p>由于强连通分量中的点可以互相到达, 所以在一个强连通中的最大获利就是强连通中最贵的-最便宜的. 我们把所有强连通分量求出来缩为两个点之后. 1与n之间只存在一些无环路径, 对于这些单向的无环路径我们只需要扫描一遍便可求出最大获利.</p>
<p>强连通缩为两个点的具体做法: 把一个强连通缩为a,b 两个点, 连(a,b)边, a的费用为强连通中最便宜的, b的费用为强连通中最贵的. 把指向强连通中任何一个点的所有边改为指向a, 把强连通中任何一点指向强连通外部的边改为由b指出. 这样构出来的保证与原图等价.</p>
<p><strong>第四题(</strong><strong>靶形数独, sudoku)</strong>: 很直白的搜索, 由于数独是NP-H问题, 所以我们肯定只能用搜索, 那么关键就在于剪枝了, 我们发现, 对于每个格子都有一个取值范围, 这个范围由其横行/纵行/小九宫格中已填的数决定, 那么无疑我们每次搜索选取值范围最小的格子搜是比较优的.<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/172" title="Struggle for NOIp 2009!">Struggle for NOIp 2009!</a></li>
<li><a href="http://www.cnphil.com/archives/119" title="Struggle For HNOI 2009!">Struggle For HNOI 2009!</a></li>
<li><a href="http://www.cnphil.com/archives/78" title="CCF 是对的 &mdash; 一个信息学竞赛选手的自白">CCF 是对的 &mdash; 一个信息学竞赛选手的自白</a></li>
<li><a href="http://www.cnphil.com/archives/73" title="NOI 2009 冬令营 · 笔记 (二)">NOI 2009 冬令营 · 笔记 (二)</a></li>
<li><a href="http://www.cnphil.com/archives/70" title="NOI 2009 冬令营 · 笔记 (一)">NOI 2009 冬令营 · 笔记 (一)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/177/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A bolt of lightning.</title>
		<link>http://www.cnphil.com/archives/175</link>
		<comments>http://www.cnphil.com/archives/175#comments</comments>
		<pubDate>Mon, 23 Nov 2009 04:48:47 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Informatics]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=175</guid>
		<description><![CDATA[不曾想会变成这样&#8230;
桌子出的题我都能这么失误, 不过还好不是烟台, 那才是我的目标.
Every cloud has a silver lining.
Be confident, and then I will win.
Random Posts

岁末杂记
NOI 2009 冬令营 · 笔记 (一)
Vote for Barack Obama
XP 提权的再研究
简单却难证明的数列猜想

]]></description>
			<content:encoded><![CDATA[<p>不曾想会变成这样&#8230;</p>
<p>桌子出的题我都能这么失误, 不过还好不是烟台, 那才是我的目标.</p>
<p>Every cloud has a silver lining.</p>
<p>Be confident, and then I will win.<br />
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/31" title="关于计算机科学的研究计划 &#8211; 两年">关于计算机科学的研究计划 &#8211; 两年</a></li>
<li><a href="http://www.cnphil.com/archives/131" title="是否存在第n个素数的公式呢?">是否存在第n个素数的公式呢?</a></li>
<li><a href="http://www.cnphil.com/archives/60" title="Vijos 服务器后台程序 安装使用全程图解">Vijos 服务器后台程序 安装使用全程图解</a></li>
<li><a href="http://www.cnphil.com/archives/169" title="Nim 取石子游戏的一些变种">Nim 取石子游戏的一些变种</a></li>
<li><a href="http://www.cnphil.com/archives/20" title="NOIp 模拟测试解题报告（1）">NOIp 模拟测试解题报告（1）</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/175/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Struggle for NOIp 2009!</title>
		<link>http://www.cnphil.com/archives/172</link>
		<comments>http://www.cnphil.com/archives/172#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:00:09 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Informatics]]></category>
		<category><![CDATA[NOI]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=172</guid>
		<description><![CDATA[RP++
Struggle for what you want!
Be confident, and I will win!
Related Posts

NOIp 2009 解题报告
Struggle For HNOI 2009!
NOI 2009 冬令营 · 笔记 (二)
NOI 2009 冬令营 · 笔记 (一)

]]></description>
			<content:encoded><![CDATA[<h1>RP++</h1>
<p>Struggle for what you want!</p>
<p>Be confident, and I will win!<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/177" title="NOIp 2009 解题报告">NOIp 2009 解题报告</a></li>
<li><a href="http://www.cnphil.com/archives/119" title="Struggle For HNOI 2009!">Struggle For HNOI 2009!</a></li>
<li><a href="http://www.cnphil.com/archives/73" title="NOI 2009 冬令营 · 笔记 (二)">NOI 2009 冬令营 · 笔记 (二)</a></li>
<li><a href="http://www.cnphil.com/archives/70" title="NOI 2009 冬令营 · 笔记 (一)">NOI 2009 冬令营 · 笔记 (一)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/172/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nim 取石子游戏的一些变种</title>
		<link>http://www.cnphil.com/archives/169</link>
		<comments>http://www.cnphil.com/archives/169#comments</comments>
		<pubDate>Thu, 19 Nov 2009 16:55:50 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Brainstorm]]></category>
		<category><![CDATA[Informatics]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=169</guid>
		<description><![CDATA[大家都知道正常的Nim游戏是取完最后一个赢. 必胜态是各堆石子异或值不为0. 现在来看看几个有意思的变种.
变种1: 取到最后一个石子的人输.
首先明确奇数个1是必败态, 偶数个1是必胜态. 这与正常的Nim不一致.
若只有一堆的个数大于1, 那么现在可以控制全场的1个数的奇偶性, 所以是必胜的. 这与正常的Nim一致.
若不止一堆的个数大于1, 由于不能转移到全是1的状态, (可能可以转移到仅有一堆大于1的状态, 但此状态与正常Nim一致), 所有当前可以转移到的状态的胜负性都是与正常的Nim一致的, 所以当前状态的胜负性与正常的Nim也是一致的.
综上, 除了全是1的状态胜负性跟正常的Nim不一致, 其余的状态胜负性与正常的Nim一致.
变种2: 只能从最左或最右的一堆中取, 取到最后一个的赢.
对于 [L,X,R] 状态, 若其是必败状态, 那么&#124;L-R&#124;&#60;=1.
证明: 设[L,X,R]是必败态且R&#60;L-1, 那么, 对于任何的1&#60;=L&#8217;&#60;L, [L',X,R]是必胜态. 那么对于每个L&#8217;, 都存在R&#8217;&#60;R使得[L',X,R']是必败态, 显然不会出现[a,X,b]和[a',X,b]同为必败态的情况, 但L&#8217;有L-1个取值, R&#8217;却没有L-1个取值, 所以对于任意必败态[L,X,R], 都有&#124;L-R&#124;1则是必胜态, 否则, 由[X]的胜负性以及L-R的值可以推导出[L,X,R]的胜负性.
Random Posts

High School Musical 3 · HP 2230s
NOIp 模拟测试解题报告（1）
Pascal 中的操作符定义与重载操作符定义
新托福IBT备考教材清单
关于计算机科学的研究计划 &#8211; 两年

]]></description>
			<content:encoded><![CDATA[<p>大家都知道正常的Nim游戏是取完最后一个赢. 必胜态是各堆石子异或值不为0. 现在来看看几个有意思的变种.</p>
<p>变种1: 取到最后一个石子的人输.<br />
首先明确奇数个1是必败态, 偶数个1是必胜态. 这与正常的Nim不一致.<br />
若只有一堆的个数大于1, 那么现在可以控制全场的1个数的奇偶性, 所以是必胜的. 这与正常的Nim一致.<br />
若不止一堆的个数大于1, 由于不能转移到全是1的状态, (可能可以转移到仅有一堆大于1的状态, 但此状态与正常Nim一致), 所有当前可以转移到的状态的胜负性都是与正常的Nim一致的, 所以当前状态的胜负性与正常的Nim也是一致的.<br />
综上, 除了全是1的状态胜负性跟正常的Nim不一致, 其余的状态胜负性与正常的Nim一致.</p>
<p>变种2: 只能从最左或最右的一堆中取, 取到最后一个的赢.<br />
对于 [L,X,R] 状态, 若其是必败状态, 那么|L-R|&lt;=1.<br />
证明: 设[L,X,R]是必败态且R&lt;L-1, 那么, 对于任何的1&lt;=L&#8217;&lt;L, [L',X,R]是必胜态. 那么对于每个L&#8217;, 都存在R&#8217;&lt;R使得[L',X,R']是必败态, 显然不会出现[a,X,b]和[a',X,b]同为必败态的情况, 但L&#8217;有L-1个取值, R&#8217;却没有L-1个取值, 所以对于任意必败态[L,X,R], 都有|L-R|1则是必胜态, 否则, 由[X]的胜负性以及L-R的值可以推导出[L,X,R]的胜负性.<br />
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/23" title="Phil 一至三年计划">Phil 一至三年计划</a></li>
<li><a href="http://www.cnphil.com/archives/172" title="Struggle for NOIp 2009!">Struggle for NOIp 2009!</a></li>
<li><a href="http://www.cnphil.com/archives/186" title="做数学与做学问">做数学与做学问</a></li>
<li><a href="http://www.cnphil.com/archives/33" title="月考感悟·科学探究">月考感悟·科学探究</a></li>
<li><a href="http://www.cnphil.com/archives/64" title="NOIp · 圆梦">NOIp · 圆梦</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/169/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>简单却难证明的数列猜想</title>
		<link>http://www.cnphil.com/archives/156</link>
		<comments>http://www.cnphil.com/archives/156#comments</comments>
		<pubDate>Fri, 11 Sep 2009 07:03:13 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Brainstorm]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=156</guid>
		<description><![CDATA[我们又要开始讨论有关素数的问题了. 各位大牛在考试中肯定有很多时间剩余,  在考场里闲着无聊怎么办呢? 在草稿纸上写写画画? 于是你就开始写素数数列:
2, 3, 5, 7, 11, 13, 17,19, 23, 29, 31, …
写了几项后决心利用考试剩余的时间解决几个世纪以来的各种素数生成问题. 素数数列有什么规律呢? 从等差数列开始算吧. 看一看素数数列的各项与其后一项之间的差:
1, 2, 2, 4, 2, 4, 2, 4, …
你相信素数数列不会是这么简单, 觉得它有可能是n-阶等差数列, 于是你无聊地再把差数列又减了一次:
1, 0, 2, -2, 2, 2, 2, 2, 4, …
啊? 竟然出现了最讨厌的负数?! 恼怒的你决定把所有的负数全都取绝对值, 再把数列减一次:
1, 2, 0, 0, 0, 0, 0, 2, …
就当你准备再减一次的时候, 你发现了一件怪事: 为什么每个数列的第一项都是1? 惊奇不已的你准备放弃解决几个世纪以来的素数难题, 转而研究这个问题. 在考试结束之时, 你已经列了几百个数列了, 它们都是以1打头的, [...]]]></description>
			<content:encoded><![CDATA[<p>我们又要开始讨论有关素数的问题了. 各位大牛在考试中肯定有很多时间剩余,  在考场里闲着无聊怎么办呢? 在草稿纸上写写画画? 于是你就开始写素数数列:</p>
<p>2, 3, 5, 7, 11, 13, 17,19, 23, 29, 31, …</p>
<p>写了几项后决心利用考试剩余的时间解决几个世纪以来的各种素数生成问题. 素数数列有什么规律呢? 从等差数列开始算吧. 看一看素数数列的各项与其后一项之间的差:</p>
<p>1, 2, 2, 4, 2, 4, 2, 4, …</p>
<p>你相信素数数列不会是这么简单, 觉得它有可能是n-阶等差数列, 于是你无聊地再把差数列又减了一次:</p>
<p>1, 0, 2, -2, 2, 2, 2, 2, 4, …</p>
<p>啊? 竟然出现了最讨厌的负数?! 恼怒的你决定把所有的负数全都取绝对值, 再把数列减一次:</p>
<p>1, 2, 0, 0, 0, 0, 0, 2, …</p>
<p>就当你准备再减一次的时候, 你发现了一件怪事: 为什么每个数列的第一项都是1? 惊奇不已的你准备放弃解决几个世纪以来的素数难题, 转而研究这个问题. 在考试结束之时, 你已经列了几百个数列了, 它们都是以1打头的, 于是你猜想每一个这样的数列都是以1打头的.</p>
<p><span id="more-156"></span>在回家的路上沉吟思索而撞了几根电线杆子的你回到家中, 以迅雷不及掩耳之势打开电脑, 开始用程序验证, 结果发现前几万个数列都是以1打头的. 惊喜的你开始思考怎么证明这个问题: 要证明这个问题就要弄清楚素数之间的关系, 也要弄清楚素数的生成问题, 于是又回到了几个世纪以来的难题上&#8230;</p>
<p>极度愤怒的你再次打开电脑查找资料, 发现有一个叫Gilbreath的无聊geek在1958年就提出了这个无聊问题, 这个无聊问题就叫做Gilbreath猜想, 于1878年被François Proth第一次发现并给出了一个错误的证明. 一个多个世纪以来, 这个无聊的猜想祸害了一代又一代的无聊数学家. Paul Erdős干脆说这个无聊猜想要等到两百年后才有完全的证明&#8230; Erdős老师大概是不想让太多的数学家在这个无聊猜想上浪费光阴吧.</p>
<address><span style="color: #888888">来源:</span></address>
<address><span style="color: #888888"><a title="Source" href="http://www.johndcook.com/blog/2009/09/09/gilbreath-conjecture/">http://www.johndcook.com/blog/2009/09/09/gilbreath-conjecture/</a></span></address>
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/68" title="圣诞和美剧">圣诞和美剧</a></li>
<li><a href="http://www.cnphil.com/archives/5" title="新三，新东方，新时代的开始！">新三，新东方，新时代的开始！</a></li>
<li><a href="http://www.cnphil.com/archives/3" title="cnPhil, Start Blogging!">cnPhil, Start Blogging!</a></li>
<li><a href="http://www.cnphil.com/archives/195" title="Go For Chefoo!">Go For Chefoo!</a></li>
<li><a href="http://www.cnphil.com/archives/23" title="Phil 一至三年计划">Phil 一至三年计划</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/156/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>公开密钥的加密法: RSA加密算法</title>
		<link>http://www.cnphil.com/archives/138</link>
		<comments>http://www.cnphil.com/archives/138#comments</comments>
		<pubDate>Thu, 23 Jul 2009 09:17:00 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Informatics]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Primes]]></category>
		<category><![CDATA[RSA]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=138</guid>
		<description><![CDATA[
假如Alice和Bob需要经过一个不可靠媒介传送一条消息, 他们大概会把这条消息加密, 而普遍使用的字母移位法(凯撒加密法)太容易被破解, 所以他们可能会考虑使用更加安全的加密法.



在上个世纪70年代被麻省理工学院的三位教授发明的RSA加密算法就是一个足够安全的加密法, 当今互联网的SSL安全连接协议的重要加密算法就包括了RSA加密算法. 连接到你的网上银行, 查看这个安全连接的证书, 证书上很可能写的就是“RSA加密”.


当然, RSA被广泛使用的原因还有一个, 那就是它的加密钥匙是公开的, 也就是说, 任何人都可以使用公开的密钥给消息加密, 却无法给刚加密的消息解密.

现在, 若Alice需要接收一条来自Bob的消息, 她可以这样来生成密钥:



随机选取两个不相等的较大素数p和q, 	计算N=pq.


根据欧拉函数, 	计算不大于N且与N互质的正整数个数 φ(N) = (p-1)(q-1).


选取小于φ(N)且与φ(N)互质的正整数e.


选取小于φ(N)的正整数d, 	使得e和d满足 (d×e) Mod φ(N)=1.


将公钥N和e公开, 	保存好私钥d, 销毁p和q的记录.




关于私钥d的计算, 在实际应用中经常通过对e做模逆运算来得到d, 而高效解模逆运算的算法就是扩展Euclid算法.




此时, Bob已经知道了公钥N和e, 对于他要发送的消息n (n&#60;N), 他可以计算出把n加密后的消息c=ne Mod N. Bob此时可以放心地把c发送给Alice了.


 对于Alice收到的加密消息c, 她可以解密出原消息n=cd Mod N.


 这样解密的原理是: 因为 c≡ne (Mod N), 所以 cd≡ned (Mod N), 又因为(ed) Mod φ(N)=1, 根据费马小定理, 会有 ned≡n (Mod [...]]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">假如</span>Alice<span style="font-family: DejaVu Sans;">和</span>Bob<span style="font-family: DejaVu Sans;">需要经过一个不可靠媒介传送一条消息</span>, <span style="font-family: DejaVu Sans;">他们大概会把这条消息加密</span>, <span style="font-family: DejaVu Sans;">而普遍使用的字母移位法</span>(<span style="font-family: DejaVu Sans;">凯撒加密法</span>)<span style="font-family: DejaVu Sans;">太容易被破解</span>, <span style="font-family: DejaVu Sans;">所以他们可能会考虑使用更加安全的加密法</span>.</p>
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in;"><em><br />
</em></p>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">在上个世纪</span>70<span style="font-family: DejaVu Sans;">年代被麻省理工学院的三位教授发明的</span>RSA<span style="font-family: DejaVu Sans;">加密算法就是一个足够安全的加密法</span>, <span style="font-family: DejaVu Sans;">当今互联网的</span>SSL<span style="font-family: DejaVu Sans;">安全连接协议的重要加密算法就包括了</span>RSA<span style="font-family: DejaVu Sans;">加密算法</span>. <span style="font-family: DejaVu Sans;">连接到你的网上银行</span>, <span style="font-family: DejaVu Sans;">查看这个安全连接的证书</span>, <span style="font-family: DejaVu Sans;">证书上很可能写的就是</span>“RSA<span style="font-family: DejaVu Sans;">加密</span>”.</p>
<p style="margin-bottom: 0in; text-align: center;"><img class="aligncenter" src="http://pics.philhu.net/2009/2009072301.png" alt="" width="274" height="83" /></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">当然</span>, RSA<span style="font-family: DejaVu Sans;">被广泛使用的原因还有一个</span>, <span style="font-family: DejaVu Sans;">那就是它的加密钥匙是公开的</span>, <span style="font-family: DejaVu Sans;">也就是说</span>, <span style="font-family: DejaVu Sans;">任何人都可以使用公开的密钥给消息加密</span>, <span style="font-family: DejaVu Sans;">却无法给刚加密的消息解密</span>.</p>
<p><span id="more-138"></span></p>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">现在</span>, <span style="font-family: DejaVu Sans;">若</span>Alice<span style="font-family: DejaVu Sans;">需要接收一条来自</span>Bob<span style="font-family: DejaVu Sans;">的消息</span>, <span style="font-family: DejaVu Sans;">她可以这样来生成密钥</span>:</p>
<blockquote><p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<ol>
<li>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">随机选取两个不相等的较大素数</span><em>p</em><span style="font-family: DejaVu Sans;">和</span><em>q</em>, 	<span style="font-family: DejaVu Sans;">计算</span><em>N</em>=<em>pq</em>.</p>
</li>
<li>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">根据欧拉函数</span>, 	<span style="font-family: DejaVu Sans;">计算不大于</span><em>N</em><span style="font-family: DejaVu Sans;">且与</span><em>N</em><span style="font-family: DejaVu Sans;">互质的正整数个数 </span><em>φ</em>(<em>N</em>) = (<em>p</em>-1)(<em>q</em>-1).</p>
</li>
<li>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">选取小于</span><em>φ</em>(<em>N</em>)<span style="font-family: DejaVu Sans;">且与</span><em>φ</em>(<em>N</em>)<span style="font-family: DejaVu Sans;">互质的正整数</span><em>e.</em></p>
</li>
<li>
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">选取小于</span><em>φ</em>(<em>N</em>)<span style="font-family: DejaVu Sans;">的正整数</span><em>d</em>, 	<span style="font-family: DejaVu Sans;">使得</span><em>e</em><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">和</span></span><em>d</em><span style="font-family: DejaVu Sans;">满足<span style="font-style: normal;"> </span></span><span style="font-style: normal;">(</span><em>d</em><em>×e</em><span style="font-style: normal;">)</span><em> </em><span style="font-style: normal;">Mod </span><em>φ</em><span style="font-style: normal;">(</span><em>N</em><span style="font-style: normal;">)=1</span><em>.</em></p>
</li>
<li>
<p style="margin-bottom: 0in; font-style: normal;"><span style="font-family: DejaVu Sans;">将公钥</span><em>N</em><span style="font-family: DejaVu Sans;">和</span><em>e</em><span style="font-family: DejaVu Sans;">公开</span>, 	<span style="font-family: DejaVu Sans;">保存好私钥</span><em>d</em>, <span style="font-family: DejaVu Sans;">销毁</span><em>p</em><span style="font-family: DejaVu Sans;">和</span><em>q</em><span style="font-family: DejaVu Sans;">的记录</span>.</p>
</li>
</ol>
</blockquote>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in; font-style: normal;"><span style="font-family: DejaVu Sans;">关于私钥</span><em>d</em><span style="font-family: DejaVu Sans;">的计算</span>, <span style="font-family: DejaVu Sans;">在实际应用中经常通过对</span><em>e</em><span style="font-family: DejaVu Sans;">做模逆运算来得到</span><em>d</em>, <span style="font-family: DejaVu Sans;">而高效解模逆运算的算法就是扩展</span>Euclid<span style="font-family: DejaVu Sans;">算法</span>.</p>
<p style="margin-bottom: 0in;"><em><br />
</em></p>
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">此时</span>, Bob<span style="font-family: DejaVu Sans;">已经知道了公钥</span><em>N</em><span style="font-family: DejaVu Sans;">和</span><em>e, </em><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">对于他要发送的消息</span></span><em>n </em><span style="font-style: normal;">(</span><em>n</em><span style="font-style: normal;">&lt;</span><em>N</em><span style="font-style: normal;">), </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">他可以计算出把</span></span><em>n</em><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">加密后的消息</span></span><em>c=n</em><sup><em>e</em></sup><em> </em><span style="font-style: normal;">Mod </span><em>N</em><span style="font-style: normal;">. Bob</span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">此时可以放心地把</span></span><em>c</em><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">发送给</span></span><span style="font-style: normal;">Alice</span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">了</span></span><span style="font-style: normal;">.</span></p>
<p style="margin-bottom: 0in;"><span style="font-style: normal;"><br />
</span></p>
<p style="margin-bottom: 0in;"><span style="font-style: normal;"> </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">对于</span></span><span style="font-style: normal;">Alice</span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">收到的加密消息</span></span><em>c</em><span style="font-style: normal;">, </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">她可以解密出原消息</span></span><em>n</em><span style="font-style: normal;">=</span><em>c</em><sup><em>d</em></sup><span style="font-style: normal;"> Mod </span><em>N</em><span style="font-style: normal;">.</span></p>
<p style="margin-bottom: 0in;"><span style="font-style: normal;"><br />
</span></p>
<p style="margin-bottom: 0in;"><span style="font-style: normal;"> </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">这样解密的原理是</span></span><span style="font-style: normal;">: </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">因为 </span></span><em>c</em><span style="font-style: normal;">≡</span><em>n</em><sup><em>e </em></sup><span style="font-style: normal;">(Mod </span><em>N</em><span style="font-style: normal;">), </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">所以 </span></span><em>c</em><sup><em>d</em></sup><span style="font-style: normal;">≡</span><em>n</em><sup><em>ed</em></sup><em> </em><span style="font-style: normal;">(Mod </span><em>N</em><span style="font-style: normal;">), </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">又因为</span></span><span style="font-style: normal;">(</span><em>ed</em><span style="font-style: normal;">)</span><em> </em><span style="font-style: normal;">Mod </span><em>φ</em><span style="font-style: normal;">(</span><em>N</em><span style="font-style: normal;">)=1, </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">根据费马小定理</span></span><span style="font-style: normal;">, </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">会有 </span></span><em>n</em><sup><em>ed</em></sup><span style="font-style: normal;">≡</span><em>n</em><span style="font-style: normal;"> (Mod </span><em>N</em><span style="font-style: normal;">) , </span><span style="font-family: DejaVu Sans;"><span style="font-style: normal;">从而 </span></span><em>n</em><span style="font-style: normal;">=</span><em>c</em><sup><em>d</em></sup><span style="font-style: normal;"> Mod </span><em>N.</em></p>
<p style="margin-bottom: 0in;"><em><br />
</em></p>
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;"><span style="font-family: DejaVu Sans;">若中间偷听者</span>Eve<span style="font-family: DejaVu Sans;">截获了密文</span><em>c</em>, <span style="font-family: DejaVu Sans;">目前直接由公钥</span><em>N</em>, <em>e</em>,<span style="font-family: DejaVu Sans;">密文</span><em>c</em><span style="font-family: DejaVu Sans;">导出原消息</span><em>n</em><span style="font-family: DejaVu Sans;">的唯一方法就是将公钥</span><em>N</em><span style="font-family: DejaVu Sans;">因式分解得到</span><em>p</em><span style="font-family: DejaVu Sans;">和</span><em>q</em>, <span style="font-family: DejaVu Sans;">计算得</span><em>φ</em>(<em>N</em>)<span style="font-family: DejaVu Sans;">后</span>, <span style="font-family: DejaVu Sans;">再由公钥</span><em>e</em><span style="font-family: DejaVu Sans;">计算出私钥</span><em>d</em>, <span style="font-family: DejaVu Sans;">而目前因式分解的较优算法仍然有</span>O(n<sup>1/2</sup>)<span style="font-family: DejaVu Sans;">的复杂度</span>, <span style="font-family: DejaVu Sans;">所以</span>Eve<span style="font-family: DejaVu Sans;">想要还原消息</span><em>n</em><span style="font-family: DejaVu Sans;">是相当困难的</span>.</p>
<p style="margin-bottom: 0in;"><em><br />
</em></p>
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;"><span style="font-family: DejaVu Sans;">上个世纪</span>90<span style="font-family: DejaVu Sans;">年代</span>, <span style="font-family: DejaVu Sans;">数百台计算机用了五个月的时间合作因式分解了一个长达</span>512<span style="font-family: DejaVu Sans;">位的</span>RSA-155<span style="font-family: DejaVu Sans;">号公钥</span><em>N</em>, <span style="font-family: DejaVu Sans;">所以</span>, <span style="font-family: DejaVu Sans;">现代</span>SSL<span style="font-family: DejaVu Sans;">安全协议对公钥</span><em>N</em><span style="font-family: DejaVu Sans;">的要求是起码</span>1024<span style="font-family: DejaVu Sans;">位</span>, <span style="font-family: DejaVu Sans;">而且</span><em>φ</em>(<em>N</em>)<span style="font-family: DejaVu Sans;">不应有过小的质因数</span>, <span style="font-family: DejaVu Sans;">所以在生成</span><em>p</em>,<em>q</em><span style="font-family: DejaVu Sans;">时</span>, <span style="font-family: DejaVu Sans;">通常是选取随机值再用</span>Miller-Rabin<span style="font-family: DejaVu Sans;">测试来检验随机值是否为素数</span>.</p>
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in; font-style: normal;">
<p style="margin-bottom: 0in;"><em><br />
</em></p>
<p style="margin-bottom: 0in; font-style: normal;"><span style="font-family: DejaVu Sans;">现在的</span>RSA<span style="font-family: DejaVu Sans;">加密算法看起来无懈可击</span>, <span style="font-family: DejaVu Sans;">但是若多项式时间的因式分解算法被发现</span>, <span style="font-family: DejaVu Sans;">或者能在多项式时间内分解因式的量子计算机被发明</span>, <span style="font-family: DejaVu Sans;">那么</span>RSA<span style="font-family: DejaVu Sans;">也会变得跟凯撒加密法一样脆弱</span>, <span style="font-family: DejaVu Sans;">到那时</span>, <span style="font-family: DejaVu Sans;">我们就需要发明新的加密传输方法了</span>.</p>
<p style="margin-bottom: 0in; font-style: normal;">
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		A:link { so-language: zxx } --></p>
<p style="margin-bottom: 0in; font-style: normal;"><span style="color: #888888;">参考资料:</span></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in; font-style: normal;"><span style="color: #888888;"> 1<span style="color: #888888;">. </span></span><span style="color: #888888;"><em>Classical and Contemporary Cryptology</em>, Richard Spillman.</span></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		A:link { so-language: zxx } --></p>
<p style="margin-bottom: 0in; font-style: normal;"><span style="color: #888888;"> 2. <em><a href="http://en.wikipedia.org/wiki/Rsa">RSA</a></em> entry from Wikipedia.</span></p>
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/53" title="Pascal 中的操作符定义与重载操作符定义">Pascal 中的操作符定义与重载操作符定义</a></li>
<li><a href="http://www.cnphil.com/archives/96" title="与 cnPhil.com 一起加入『地球一小时&middot;2009』行动">与 cnPhil.com 一起加入『地球一小时&middot;2009』行动</a></li>
<li><a href="http://www.cnphil.com/archives/29" title="XP 提权的再研究">XP 提权的再研究</a></li>
<li><a href="http://www.cnphil.com/archives/70" title="NOI 2009 冬令营 · 笔记 (一)">NOI 2009 冬令营 · 笔记 (一)</a></li>
<li><a href="http://www.cnphil.com/archives/36" title="TOEFL规划">TOEFL规划</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/138/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>是否存在第n个素数的公式呢?</title>
		<link>http://www.cnphil.com/archives/131</link>
		<comments>http://www.cnphil.com/archives/131#comments</comments>
		<pubDate>Mon, 20 Jul 2009 16:26:02 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Brainstorm]]></category>
		<category><![CDATA[General Math]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=131</guid>
		<description><![CDATA[我们经常跟素数打交道, 我们知道素数的各种验证算法, 但是是否存在素数的生成算法呢?
事实上, 我们有许多可以生成素数的算法, 但是, 由于这些算法的效率极低, 我们基本上不会使用这些算法.
方法一: 素数编码
设 pn 是第n个素数, Sierpinski 先生曾经定义了这样一个常量:

若定义[x]为一取下整函数, 即[x]表示不大于x的最大整数. 那么我们有:

对于这一类方法, 当把相关常量计算出来时才有实际价值, 这似乎不太可能.
方法二: 利用 Wilson 原理

Willans 先生这样定义了函数 pi(x) :

那么, 对于大于2的任意整数n, 我们有:

这个方法虽然比前一个更具体, 但是, 其中涉及到了很大的数, 要应用到实际运算中还有一定的困难.
关于素数还有很多精彩的算法, 比如验证素数的 Miller-Rabin 测试, 以及应用素数性质的 RSA 加密算法, 但有关生成素数的真正可行的算法, 还有待我们继续去探究.

参考文献: Prime FAQ, Chris K. Caldwell
Random Posts

Phil 一至三年计划
写在 Google 10岁时
NOI 2009 冬令营 · 笔记 (二)
岁末杂记
Hello world!

]]></description>
			<content:encoded><![CDATA[<p>我们经常跟素数打交道, 我们知道素数的各种验证算法, 但是是否存在素数的生成算法呢?</p>
<p>事实上, 我们有许多可以生成素数的算法, 但是, 由于这些算法的效率极低, 我们基本上不会使用这些算法.</p>
<p><strong>方法一: 素数编码</strong></p>
<p>设 <em>p</em><sub><em>n</em></sub> 是第n个素数, Sierpinski 先生曾经定义了这样一个常量:</p>
<p><img class="alignnone" src="http://pics.philhu.net/2009/2009072001.png" alt="" width="351" height="54" /></p>
<p>若定义[x]为一取下整函数, 即[x]表示不大于x的最大整数. 那么我们有:</p>
<p><img class="alignnone" src="http://pics.philhu.net/2009/2009072002.png" alt="" width="231" height="33" /></p>
<p>对于这一类方法, 当把相关常量计算出来时才有实际价值, 这似乎不太可能.</p>
<p><strong>方法二: 利用 Wilson 原理<br />
</strong></p>
<p>Willans 先生这样定义了函数 pi(x) :</p>
<p><img class="alignnone" src="http://pics.philhu.net/2009/2009072003.png" alt="" width="430" height="26" /></p>
<p>那么, 对于大于2的任意整数n, 我们有:</p>
<p><img class="alignnone" src="http://pics.philhu.net/2009/2009072004.png" alt="" width="501" height="26" /></p>
<p>这个方法虽然比前一个更具体, 但是, 其中涉及到了很大的数, 要应用到实际运算中还有一定的困难.</p>
<p>关于素数还有很多精彩的算法, 比如验证素数的 Miller-Rabin 测试, 以及应用素数性质的 RSA 加密算法, 但有关生成素数的真正可行的算法, 还有待我们继续去探究.<br />
<span id="more-131"></span><br />
<span style="color: #999999;">参考文献: <em>Prime FAQ</em>, Chris K. Caldwell</span><br />
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/36" title="TOEFL规划">TOEFL规划</a></li>
<li><a href="http://www.cnphil.com/archives/53" title="Pascal 中的操作符定义与重载操作符定义">Pascal 中的操作符定义与重载操作符定义</a></li>
<li><a href="http://www.cnphil.com/archives/175" title="A bolt of lightning.">A bolt of lightning.</a></li>
<li><a href="http://www.cnphil.com/archives/96" title="与 cnPhil.com 一起加入『地球一小时&middot;2009』行动">与 cnPhil.com 一起加入『地球一小时&middot;2009』行动</a></li>
<li><a href="http://www.cnphil.com/archives/10" title="写在 Google 10岁时">写在 Google 10岁时</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/131/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Protected: NOI 2009 湖南省队集训 试题包下载</title>
		<link>http://www.cnphil.com/archives/123</link>
		<comments>http://www.cnphil.com/archives/123#comments</comments>
		<pubDate>Sat, 18 Jul 2009 14:28:50 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Informatics]]></category>

		<guid isPermaLink="false">http://www.cnphil.com/?p=123</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://www.cnphil.com/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-123">Password:<br />
<input name="post_password" id="pwbox-123" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
<h3>Random Posts</h3>
<ul class="related_post">
<li><a href="http://www.cnphil.com/archives/62" title="Struggle For NOIp 2008!">Struggle For NOIp 2008!</a></li>
<li><a href="http://www.cnphil.com/archives/138" title="公开密钥的加密法: RSA加密算法">公开密钥的加密法: RSA加密算法</a></li>
<li><a href="http://www.cnphil.com/archives/3" title="cnPhil, Start Blogging!">cnPhil, Start Blogging!</a></li>
<li><a href="http://www.cnphil.com/archives/33" title="月考感悟·科学探究">月考感悟·科学探究</a></li>
<li><a href="http://www.cnphil.com/archives/29" title="XP 提权的再研究">XP 提权的再研究</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cnphil.com/archives/123/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
