<s>
Fermat	B-Algorithm
's	I-Algorithm
factorization	I-Algorithm
method	I-Algorithm
,	O
named	O
after	O
Pierre	O
de	O
Fermat	O
,	O
is	O
based	O
on	O
the	O
representation	O
of	O
an	O
odd	O
integer	O
as	O
the	O
difference	O
of	O
two	O
squares	O
:	O
</s>
<s>
In	O
its	O
simplest	O
form	O
,	O
Fermat	B-Algorithm
's	I-Algorithm
method	I-Algorithm
might	O
be	O
even	O
slower	O
than	O
trial	O
division	O
(	O
worst	O
case	O
)	O
.	O
</s>
<s>
But	O
observe	O
that	O
if	O
N	O
had	O
a	O
subroot	O
factor	O
above	O
,	O
Fermat	B-Algorithm
's	I-Algorithm
method	I-Algorithm
would	O
have	O
found	O
it	O
already	O
.	O
</s>
<s>
Choose	O
some	O
bound	O
;	O
use	O
Fermat	B-Algorithm
's	I-Algorithm
method	I-Algorithm
for	O
factors	O
between	O
and	O
.	O
</s>
<s>
In	O
this	O
regard	O
,	O
Fermat	B-Algorithm
's	I-Algorithm
method	I-Algorithm
gives	O
diminishing	O
returns	O
.	O
</s>
<s>
Fermat	B-Algorithm
's	I-Algorithm
method	I-Algorithm
works	O
best	O
when	O
there	O
is	O
a	O
factor	O
near	O
the	O
square-root	O
of	O
N	O
.	O
</s>
<s>
,	O
and	O
Fermat	B-Algorithm
's	I-Algorithm
method	I-Algorithm
,	O
applied	O
to	O
Nuv	O
,	O
will	O
find	O
the	O
factors	O
and	O
quickly	O
.	O
</s>
<s>
The	O
fundamental	O
ideas	O
of	O
Fermat	B-Algorithm
's	I-Algorithm
factorization	I-Algorithm
method	I-Algorithm
are	O
the	O
basis	O
of	O
the	O
quadratic	B-Algorithm
sieve	I-Algorithm
and	O
general	B-Algorithm
number	I-Algorithm
field	I-Algorithm
sieve	I-Algorithm
,	O
the	O
best-known	O
algorithms	O
for	O
factoring	O
large	O
semiprimes	O
,	O
which	O
are	O
the	O
"	O
worst-case	O
"	O
.	O
</s>
<s>
The	O
primary	O
improvement	O
that	O
quadratic	B-Algorithm
sieve	I-Algorithm
makes	O
over	O
Fermat	B-Algorithm
's	I-Algorithm
factorization	I-Algorithm
method	I-Algorithm
is	O
that	O
instead	O
of	O
simply	O
finding	O
a	O
square	O
in	O
the	O
sequence	O
of	O
,	O
it	O
finds	O
a	O
subset	O
of	O
elements	O
of	O
this	O
sequence	O
whose	O
product	O
is	O
a	O
square	O
,	O
and	O
it	O
does	O
this	O
in	O
a	O
highly	O
efficient	O
manner	O
.	O
</s>
