- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Miller Rabin Testing-资料
1.2.6 Example: Testing for Primality
This section describes two methods for checking the primality of an integer n, one with order of growth , and a probabilistic algorithm with order of growth . The exercises at the end of this section suggest programming projects based on these algorithms.
Searching for divisors
Since ancient times, mathematicians have been fascinated by problems concerning prime numbers, and many people have worked on the problem of determining ways to test if numbers are prime. One way to test if a number is prime is to find the numbers divisors. The following program finds the smallest integral divisor (greater than 1) of a given number n. It does this in a straightforward way, by testing n for divisibility by successive integers starting with 2.
(define (smallest-divisor n)
(find-divisor n 2))
(define (find-divisor n test-divisor)
(cond (( (square test-divisor) n) n)
(( divides? test-divisor n) test-divisor)
(else (find-divisor n (+ test-divisor 1)))))
(define (divides? a b)
(= (remainder b a) 0))
We can test whether a number is prime as follows: n is prime if and only if n is its own smallest divisor.
(define (prime? n)
(= n (smallest-divisor n)))
The end test for find-divisor is based on the fact that if n is not prime it must have a divisor less than or equal to . 44 This means that the algorithm need only test divisors between 1 and . Consequently, the number of steps required to identify n as prime will have order of growth .
The Fermat test
The primality test is based on a result from number theory known as Fermats Little Theorem. 45
Fermats Little Theorem: If n is a prime number and a is any positive integer less than n, then a raised to the nth power is congruent to a modulo n.
(Two numbers are said to be congruent modulo n if they both have the same remainder when divided by n. The remainder of a number a when divided by n is also referred to as the remainder modulo nmodulo n remainder of a modulo n, or
您可能关注的文档
最近下载
- 青鸟消防JBF-21SF-C系列主机说明书.pdf
- HT200电气原理图设计1.doc VIP
- Q/GDW+13053.25—2018++35-750并联电容器成套采购标准(第25部分:110(66)kV变电站10kV-6000kvar-12%电抗率框架式并联电容器成套装置专用技术规范).pdf VIP
- Q/GDW+13053.27—2018++35-750并联电容器成套采购标准(第27部分:220kV变电站10kV-8000kvar-12%电抗率框架式并联电容器成套装置专用技术规范).pdf VIP
- Q/GDW+13053.37—2018++35-750并联电容器成套采购标准(第37部分:330kV变电站35kV-40Mvar-12%电抗率框架式并联电容器成套装置专用技术规范).pdf VIP
- Q/GDW+13053.38—2018++35-750并联电容器成套采购标准(第38部分:500kV变电站35kV-60Mvar-5%电抗率框架式并联电容器成套装置专用技术规范).pdf VIP
- 柴油机发电机调试记录表格.docx VIP
- Q/GDW+13053.39—2018++35-750并联电容器成套采购标准(第39部分:500kV变电站35kV-60Mvar-12%电抗率框架式并联电容器成套装置专用技术规范).pdf VIP
- Q/GDW+13053.41—2018++35-750并联电容器成套采购标准(第41部分:220kV变电站66kV-10Mvar-12%电抗率框架式并联电容器成套装置专用技术规范).pdf VIP
- 人教版小学三年级下册数学应用题专项练习题100道.docx VIP
文档评论(0)