info prev up next book cdrom email home

Direct Search Factorization

Direct search factorization is the simplest 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. This approach is very inefficient, and can be used only with fairly small numbers.


When using this method on a number $n$, only Divisors up to $\left\lfloor{\sqrt{n}}\right\rfloor $ (where $\left\lfloor{x}\right\rfloor $ is the Floor Function) need to be tested. This is true since if all Integers less than this had been tried, then

\begin{displaymath}
{n\over \lfloor \sqrt{n}\rfloor+1} <\sqrt{n}.
\end{displaymath} (1)

In other words, all possible Factors have had their Cofactors already tested. It is also true that, when the smallest Prime Factor $p$ of $n$ is $>{\root 3 \of n}$, then its Cofactor $m$ (such that $n=pm$) must be Prime. To prove this, suppose that the smallest $p$ is $>{\root 3 \of n}$. If $m=ab$, then the smallest value $a$ and $b$ could assume is $p$. But then
\begin{displaymath}
n=pm=pab =p^3 >n,
\end{displaymath} (2)

which cannot be true. Therefore, $m$ must be Prime, so
\begin{displaymath}
n=p_1p_2.
\end{displaymath} (3)

See also Prime Factorization Algorithms, Trial Division




© 1996-9 Eric W. Weisstein
1999-05-24