原书出处
Introduction to Algorithms, Fourth Edition
31 第31章 数论算法
f testing for primality is trial division: try dividing n by each integer 2, 3, 5, 7, 9, …
, , skipping even integers greater than 2. We can conclude that n is prime if and only if none of the trial divisors divides n. Assuming that each trial division takes constant time, the worst-case running time is , which is exponential in the length of n. (Recall that if n is encoded in binary using β bits, then β = ⌈1g(n + 1)⌉, and
so .) Thus, trial division works well only if n is very small or happens to have a small
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Introduction to Algorithms, Fourth Edition/_epub-src/OEBPS/chapter031.xhtml
EPUB SHA-256:ec7ced04bb875b93983816aef7a667855a4b71c5cf53b63406b9439c74e27aea