中国剩余定及由此解决的一个问题

来源:互联网 发布:ubuntu intel网卡驱动 编辑:程序博客网 时间:2024/05/06 23:10

我国古代数学名著《孙子算经》中,记载这样一个问题: “今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问物几何。”用现在的话来说就是:“有一批物品,33个地数余2个,55个地数余3个,77个地数余2个,问这批物品最少有多少个?

 这个问题的解题思路,被称为“孙子问题”、“鬼谷算”、“隔墙算”、“韩信点兵”等等.那么,这个问题怎呢?明朝数学家程大位把这一解法编成四句歌诀:
  
三人同行七十(70)稀,
  五树梅花廿一(21)枝,
    
七子团圆正月半(15),
   除百零五(105)便得知。
 歌诀中每一句话都是一步解法:第一句指除以3的余数用70去乘;第二句指除以5的余数用21去乘;第三句指除以7的余数用15去乘;第四句指上面乘得的三个积相加的和如超过105,就减去105的倍数,就得到答案了。即:
     70
×221×315×2105×2=23

《孙子算经》的“物不知数”题虽然开创了一次同余式研究的先河,但由于题目比较简单,甚至用试猜的方法也能求得,所以尚没有上升到一套完整的计算程序和理论的高度。真正从完整的计算程序和理论上解决这个问题的,是南宋时期的数学家秦九韶。秦九韶于公元1247年写成的《数书九章》一书中提出了一个数学方法“大衍求一术”,系统地论述了一次同余式组解法的基本原理和一般程序。
    
从《孙子算经》到秦九韶《数书九章》对一次同余式问题的研究成果,在19世纪中期开始受到西方数学界的重视。1852年,英国传教士伟烈亚力向欧洲介绍了《孙子算经》的“物不知数”题和秦九韶的“大衍求一术”;1876年,德国人马蒂生指出,中国的这一解法与西方19世纪高斯《算术探究》中关于一次同余式组的解法完全一致。从此,中国古代数学的这一创造逐渐受到世界学者的瞩目,并在西方数学史著作中正式被称为“中国剩余定理”。

“中国剩余定理”算理及其应用:

   为什么这样解呢?因为7057的公倍数,且除以312137的公倍数,且除以511535的公倍数,且除以71。(任何一个一次同余式组,只要根据这个规律求出那几个关键数字,那么这个一次同余式组就不难解出了。)把702115这三个数分别乘以它们的余数,再把三个积加起来是233,符合题意,但不是最小,而105又是357的最小公倍数,去掉105的倍数,剩下的差就是最小的一个答案。
用歌诀解题容易记忆,但有它的局限性,只能限于用357三个数去除,用其它的数去除就不行了。后来我国数学家又研究了这个问题,运用了像上面分析的方法那样进行解答。


1:一个数被3除余1,被4除余2,被5除余4,这个数最小是几?
题中345三个数两两互质。
则〔45=20;〔35=15;〔34=12;〔345=60
为了使203除余1,用20×2=40
使154除余1,用15×3=45
使125除余1,用12×3=36
然后,40×145×236×4=274
因为,274>60,所以,27460×4=34,就是所求的数。

2:一个数被3除余2,被7除余4,被8除余5,这个数最小是几?
题中378三个数两两互质。
则〔78=56;〔38=24;〔37=21;〔378=168
为了使563除余1,用56×2=112
使247除余1,用24×5=120
使218除余1,用21×5=105
然后,112×2120×4105×5=1229
因为,1229>168,所以,1229168×7=53,就是所求的数。

3:一个数除以54,除以83,除以112,求满足条件的最小的自然数。
题中5811三个数两两互质。
则〔811=88;〔511=55;〔58=40;〔5811=440
为了使885除余1,用88×2=176
使558除余1,用55×7=385
使4011除余1,用40×8=320
然后,176×4385×3320×2=2499
因为,2499>440,所以,2499440×5=299,就是所求的数。

4:有一个年级的同学,每9人一排多5人,每7人一排多1人,每5人一排多2人,问这个年级至少有多少人 (幸福123老师问的题目)
题中975三个数两两互质。
则〔75=35;〔95=45;〔97=63;〔975=315
为了使359除余1,用35×8=280
使457除余1,用45×5=225
使635除余1,用63×2=126
然后,280×5225×1126×2=1877
因为,1877>315,所以,1877315×5=302,就是所求的数。

5:有一个年级的同学,每9人一排多6人,每7人一排多2人,每5人一排多3人,问这个年级至少有多少人 (泽林老师的题目)
题中975三个数两两互质。
则〔75=35;〔95=45;〔97=63;〔975=315
为了使359除余1,用35×8=280
使457除余1,用45×5=225
使635除余1,用63×2=126
然后,280×6225×2126×3=2508
因为,2508>315,所以,2508315×7=303,就是所求的数。
(例5与例4的除数相同,那么各个余数要乘的也分别相同,所不同的就是最后两步。)


 

 

先写出一个两位数62,接着在62右端写这两个数字的和为8,得到628,再写末两位数字28的和10,得到62810,用上述方法得到一个有2006位的整数:628101123……,则这个整数的数字之和是(       )。

2006-5)÷10=200....1

17+35*200+1=7018

前面的62810数字和为17

后面开始,以“1123581347”为循环节

共循环10次,每次的和为35

最后余1,就加上1

所以结果是17+35*200+1=7018

 

下面我们来看这样一道ACM的题目:

题目描述
Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. There is one peak in each period of a cycle. At the peak of a cycle, a person performs at his or her best in the corresponding field (physical, emotional or mental). For example, if it is the mental curve, thought processes will be sharper and concentration will be easier. 
Since the three cycles have different periods, the peaks of the three cycles generally occur at different times. We would like to determine when a triple peak occurs (the peaks of all three cycles occur in the same day) for any person. For each cycle, you will be given the number of days from the beginning of the current year at which one of its peaks (not necessarily the first) occurs. You will also be given a date expressed as the number of days from the beginning of the current year. You task is to determine the number of days from the given date to the next triple peak. The given date is not counted. For example, if the given date is 10 and the next triple peak occurs on day 12, the answer is 2, not 3. If a triple peak occurs on the given date, you should give the number of days to the next occurrence of a triple peak.
输入
You will be given a number of cases. The input for each case consists of one line of four integers p, e, i, and d. The values p, e, and i are the number of days from the beginning of the current year at which the physical, emotional, and intellectual cycles peak, respectively. The value d is the given date and may be smaller than any of p, e, or i. All values are non-negative and at most 365, and you may assume that a triple peak will occur within 21252 days of the given date. The end of input is indicated by a line in which p = e = i = d = -1.
输出
For each test case, print the case number followed by a message indicating the number of days to the next triple peak, in the form:

Case 1: the next triple peak occurs in 1234 days.

Use the plural form ``days'' even if the answer is 1.
样例输入
0 0 0 00 0 0 1005 20 34 3254 5 6 7283 102 23 320203 301 203 40-1 -1 -1 -1
样例输出
Case 1: the next triple peak occurs in 21252 days.Case 2: the next triple peak occurs in 21152 days.Case 3: the next triple peak occurs in 19575 days.Case 4: the next triple peak occurs in 16994 days.Case 5: the next triple peak occurs in 8910 days.Case 6: the next triple peak occurs in 10789 days.

 

用中国剩余定理解决如下:

原创粉丝点击