第二数学归纳法:硬币问题和堆垛游戏

本文通过第二数学归纳法解释了如何解决Inductia国的硬币找零问题和堆垛游戏的最高得分策略。在硬币问题中,证明了仅使用3Sg和5Sg硬币可以找开所有大于等于8Sg的面额。在堆垛游戏中,展示了无论采取何种策略,最终得分总是木块数乘以其加一的平均数的一半,这与木块数量无关。
摘要由CSDN通过智能技术生成

二数学归纳法证明的结论和第一数学归纳法是一样的,都是证明(局部)非负数元素都具有某些性质。但是第二数学归纳法中P(n)的推理是基于P(0~n)而非仅仅是P(n)。

第二数学归纳法(Strong Induction),设P是作用在非负整数的谓词:

  • P(0)成立
  • 对于所有的n,P(0), P(1), P(2) ... P(n)共同推出P(n + 1)
  • 则对于所有的非负整数m,P(m)成立

可以看到,第二数学归纳法相比于第一数学归纳法可以在推P(n + 1)的时候使用更多的假设(P(0), P(1), P(2) ... P(n) ),在使用第一数学归纳法的时候我们只用了P(n)。用公式表达如下:

Selection_061

第二数学归纳法使用的模版和第一数学归纳法很像,除了两个地方:

  1. 声明证明使用的是第二数学归纳法
  2. 推理部分要假设P(0), P(1), P(2) ... P(n) 都是正确的。




硬币问题:

在太平洋上有一个叫做Inductia的国家,他们使用一种叫做Strong的硬币(简称Sg)。当年在印刷这种硬币的时候由于经费问题就只印刷了面值为3Sg和5Sg的硬币。虽然当地居民在找小额零钱(例如4Sg或者7Sg)的时候会有一些麻烦,但是他们发现任何大于等于8Sg的面额都能使用这两种硬币找开,例如26Sg可以用下面这种方案:

请给出证明。

  1. 下面使用第二数学归纳法证明。
  2. 设P(n)为对于8+n面额的钱,居民们可以用3Sg和5Sg的硬币找开。
  3. 当n=0,8Sg = 5Sg + 3Sg,所以P(0)成立。
  4. 设p(0),p(1),p(2) ... p(n)均成立(n > 2),证明p(n + 1)成立:对于8 + n + 1的面额,可以前将其变为(8 + n + 1 - 3) + 3即(8 + n - 2) + 3这样的面额,由于我们已经假设了P(n - 2)的成立,所以(8 + n - 2) + 3可以由P(n - 2)的方案加上一个3Sg的硬币组合而成,所以P(n + 1)成立。对于n <=2:n = 2时,10 = 5 + 5;n = 1时,9 = 3*3。(这里要注意将n小于等于2的情况分开讨论,因为P(n-2)在n<2的时候没有定义,即归纳推理的“链条”不能断)
  5. 由归纳法,所有大于等于8Sg的面额居民都能用这两种硬币找开。

注:这个问题本质上是因为5和3的最大公因数是1,所以它们的线性组合可以得出任何数(1的整数倍),另外在5*1 + 3*1 = 8以上的任何数都可以用5a + 3b 表示,其中a和b都是非负数。后面我写数论部分的时候会给出具体证明的。


堆垛游戏:

在你的面前是一个由n个木块堆起来的堆垛,你每次可以将一个堆拆成两个堆,除非这个堆只剩下了一个木块。在每次分拆一个堆的时候你可以获得一些分数,例如,你将一个a+b块木块的堆拆成了a块的堆和b块的堆,你就可以得到a*b分。直到所有的堆都只含一个木块,游戏结束。例如,下图显示了一个拆一个由10个木块组成的堆的一种方案,其得分为45分 :

设请问你该采取什么策略能获得最高的分数?

我的第一想法是每次都把堆拆成两个相同高度的堆或者相差为1,例如5*5 = 25 > 1 * 9,但随后我意识到虽然第一次可能会大,但是随后可能会比较小,例如2 * 3 < 1 * 8。联想到这个题是要用归纳法的,自然觉得可能和策略无关,即不管什么策略都会得到相同的分数。试一下上面这个例子,每次都只拿走一个木块:9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 45,果然是这样,其中1+2+3 ... +n = (n+1)*n/2,下面证明:

  1. 以下证明使用第二数学归纳法。
  2. 设P(n)为对于木块数为n的堆垛,其得分为n*(n+1)/2,和策略无关。
  3. P(0) = 0,即0*(0+1)/2 = 0,成立。http://blog.sina.com.cn/s/blog_175dc3f8a0102xgxi.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgxg.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgxd.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgww.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwv.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwu.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwt.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwe.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwj.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwi.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwd.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwc.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwb.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgwa.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgw6.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgw7.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtz.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgty.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtx.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtw.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtu.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtt.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgts.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtr.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtq.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtp.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgto.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtn.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgtk.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgsh.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgsg.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgsf.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgse.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgsd.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgsc.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgsb.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgs3.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgs0.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgr4.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgqc.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgqb.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgqa.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgpp.html
    http://blog.sina.com.cn/s/blog_175dc3f8a0102xgpo.html
  4. 设P(1), P(2), P(3) ... P(n)成立。对于P(n + 1),假设我们拆的第一步将其分为了木块数分别为a和b的两个堆,第一次得分为a*b,由于a和b都小于n+1,由P(a)和P(b)成立,我们可以知道最终的总得分为第一次的得分ab加上拆剩下两个堆的分数之和:ab + a*(a+1)/2 + b*(b+1)/2 = (a^2 + b^2 + ab + a + b)/2 = (a^2 + b^2 +2ab + n + 1)/2 = ( (a+b)^2 + (n+1) )/2 = ((n+1)^2 + (n+1))/2 = (n+1 + 1)(n+1)/2。所以推得P(n+1)成立。
  5. 有归纳法得到对于任意非负整数n,这个游戏的最终得分都是n*(n+1)/2,和策略无关。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值