This preview shows pages 1–2. Sign up to view the full content.
Lecture 14: Factoring Algorithms
(Taken from Stinson section 4.8 and Elementary Number Theory
,
Rosen)
Fermat Factorization
Note that if n (odd)
n
= ab, then we can rewrite n = s
2
 t
2
, for some value of s and t, since n = (st)(s+t),
where s = (a+b)/2 and t=(ab)/2. Both s and t are integers since a and b must both be odd.
Now, to use the Fermat factorization, let n = s
2
 t
2
, then we have that t
2
= s
2
 n.
Simply start plugging in successive values for s starting with the minimal s for which s
2
>
n, until you find a solution for t.
Example: n=6077, start s=78.
78
2
 6077 = 7
79
2
 6077 = 164
80
2
 6077 = 323
81
2
 6077 = 484 = 22
2
, so
6077 = 81
2
 22
2
= (81  22)(81 + 22) = 59x103
Pollard Rho Method
Given that n=pq, the basic idea behind this method is to find to integers x and y such that
p  (x  y) but n does NOT divide into x  y. Once you find these integers, computing
gcd(n, xy) will yield a nontrivial factor of n.
The manner in which the Pollard Rho Method suggests finding x and y is as follows:
x
0
= 2 (or any random value mod n)
x
k+1
≡
f(x
k
) mod n
f should be a polynomial that produces a large set of numbers before it repeats. A
function that works well in practice is f(x) = x
2
+ 1.
Even when we produce this sequence of values, it would seem as if we should check the
difference between each pair of numbers produced. This is O(m
2
) GCD calls if m values
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Summer '09
 Algorithms

Click to edit the document details