Algorithm for extracting the prime factors of an integer

Dario Alpern alpertron at
Mon Jan 6 16:35:43 CET 2003

Paul Rubin <phr-n2002b at> wrote in message news:<7xwultbeym.fsf at>...
> "Luca Bruderer" <luca.bruderer at> writes:
> > I'm wondering which is the best algorithm to do this.
> Factoring integers of larger than 20 digits or so is a very
> complicated subject.  A good introduction can be found in "A Course in
> Number Theory and Cryptography" by Neal Koblitz.
> For less than 20 digits you can use dumb brute force algorithms and
> still get answers in a tolerable amount of time.
> The largest publicly known factorizations of "hard" composites (i.e.
> numbers with no small factors and no special properties that make them
> easier to factor) are in the range of 155 digits.  Factoring those
> numbers took thousands of CPU-years (i.e. several thousand computers
> crunching in parallel for months nonstop).
> The MIRACL package ( contains a factoring
> program that can factor numbers up to 80 digits or so on a single PC.

... or you can use the Java applet located at:

that also factors any number up to 80 digits or find prime factors of
up to about 30 digits of numbers up to 1000 digits long. The source
code is included, and you can adapt it for any non-commercial use (see
source code header).

Best regards,

Dario Alejandro Alpern
Buenos Aires - Argentina

More information about the Python-list mailing list