Here is an algorithm to find a non trivial divisor of

Info icon This preview shows pages 68–71. Sign up to view the full content.

View Full Document Right Arrow Icon
Here is an algorithm to find a non-trivial divisor of n — it uses a square root-algorithm as a subroutine. Choose z ∈ { 1 , . . . , n - 1 } at random. If gcd( z, n ) > 1, then output gcd( z, n ). Otherwise, set a := z 2 rem n , and feed a and n to the square-root algorithm. If the square-root algorithm returns an integer z 0 , and z 0 ≡ ± z (mod n ), then output “failure”; otherwise, output gcd( z - z 0 , n ), which is a non-trivial divisor of n . To analyze this algorithm, let us just consider the case where n = pq , and p and q are distinct primes. If gcd( z, n ) > 1, we split n , so assume that gcd( z, n ) = 1. In this case, [ z mod n ] is uniformly distributed over Z * n , and [ a mod n ] is uniformly distributed over ( Z * n ) 2 . Let us condition on an a fixed value of a . In this conditional probability space, [ z mod n ] is uniformly distributed over the four square roots of a , which under the isomorphism of the Chinese Remainder Theorem, correspond to ([ ± z mod p ] , [ ± z mod q ]) Z p × Z q . 63
Image of page 68

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Since the square-root algorithm receives no information about z other than the value a , the prob- ability that z 0 ≡ ± z (mod n ) is 1 / 2, in which case we output “failure”; however, if z 0 6≡ ± z , then we have either z 0 z (mod p ) and z 0 ≡ - z (mod q ) or z 0 ≡ - z (mod p ) and z 0 z (mod q ) . In the first case, gcd( z - z 0 , n ) = p , and in the second case gcd( z - z 0 , n ) = q ; in either case, we split n . That completes the analysis in the case where n = pq . In general, one can show that for any odd n that is not a prime power, the above procedure will find a non-trivial factor of n into with probability at least 1 / 2. With this, it is easy to obtain an efficient probabilistic algorithm that completely factors n . 64
Image of page 69
Chapter 11 Primality Testing In this chapter, we discuss some simple tests for primality, and also mention some results on the distribution of primes. 11.1 Trial Division Suppose we are given a number n , and we want to determine if n is prime or composite. The simplest algorithm to describe and to program is trial division . We simply divide n by 2, 3, and so on, testing if any of these numbers evenly divide n . Of course, we don’t need to go any farther than n , since if n has any nontrivial factors, it must have one that is no greater than n . Other small optimizations are also possible; for example, we don’t have to test multiples of 2 other than 2, multiples of 3 other than 3, and so on. This algorithm requires O ( n ) arithmetic operations, which is exponential in the length of n . Thus, for practical purposes, this algorithm is limited to quite small n . Suppose, for example, that n has 100 decimal digits, and that a computer can perform 1 billion divisions per second (this is much faster than any computer existing today). Then it would take 3 × 10 35 years to perform n divisions. In the next section, we discuss a much faster primality test that allows 100 decimal digit numbers to be tested for primality less than a second. Unlike the above test, however, this test does not find a factor of n when n is composite.
Image of page 70

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 71
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern