0% found this document useful (0 votes)
21 views2 pages

Number Theory Composite Number Non-Trivial Divisors: Prime Factorization Algorithm Trial Divisions Primes Divisors

Direct search factorization is the simplest prime factorization algorithm that involves systematically testing all potential divisors in increasing order to find factors that divide the original number. Fermat's factorization method involves choosing a value for a near the square root of the original number N, calculating b2 as a2 - N, and incrementing a until b2 is a perfect square, at which point factors of N are revealed. For example, to factor 647 using this method, the first value tested for a is 25, but 252 - 647 is not a square. Incrementing a to 26 yields 262 - 647 = 441, which is a square, revealing the factors of 647 as 26 + √441 and 26 - √441

Uploaded by

Think Pink
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Number Theory Composite Number Non-Trivial Divisors: Prime Factorization Algorithm Trial Divisions Primes Divisors

Direct search factorization is the simplest prime factorization algorithm that involves systematically testing all potential divisors in increasing order to find factors that divide the original number. Fermat's factorization method involves choosing a value for a near the square root of the original number N, calculating b2 as a2 - N, and incrementing a until b2 is a perfect square, at which point factors of N are revealed. For example, to factor 647 using this method, the first value tested for a is 25, but 252 - 647 is not a square. Incrementing a to 26 yields 262 - 647 = 441, which is a square, revealing the factors of 647 as 26 + √441 and 26 - √441

Uploaded by

Think Pink
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab4 Documentation

Classical factorization algorithm


In number theory, integer factorization or prime factorization is the
decomposition of a composite number into smaller non-trivial divisors, which when
multiplied together equal the original integer.
Direct search factorization is the simplest (and most simple-minded) prime
factorization algorithm. It consists of searching for factors of a number by
systematically performing trial divisions, usually using a sequence of increasing
numbers. Multiples of small primes are commonly excluded to reduce the number of
trial divisors, but just including them is sometimes faster than the time required to
exclude them. Direct search factorization is very inefficient, and can be used only
with fairly small numbers.

Fermats Factorization method


One tries various values of a, hoping that

, a square.

FermatFactor(N): // N should be odd


a ceil(sqrt(N))
b2 a*a - N
while b2 isn't a square:
a a + 1 // equivalently: b2 b2 + 2*a + 1
b2 a*a - N // a a + 1
endwhile
return a - sqrt(b2) // or a + sqrt(b2)
For example, to factor

, our first try for a is the square root of

rounded up to the next integer, which is

. Then,

Since 125 is not a square, a second try is made by increasing the value of a by
1. The second attempt also fails, because 282 is again not a square.
Try:

78

79

80

b2

125

282

441

11.18

16.79

21

The third try produces the perfect square of 441. So,


factors of

are

, and

, and the

Suppose N has more than two prime factors. That procedure first finds the
factorization with the least values of a and b. That is,
factor the square-root ofN. And so
root-N. If the procedure finds

is the smallest
is the largest factor

, that shows that N is prime.

You might also like