Search code examples
algorithmmathfactorization

programmatically factorize a large number


Alright, so I have a huge number f. This number is just over 100 digits long, actually. I know that the factors are of approximately the same size.

If I have limited resources and time, what language and algorithm should I use? I am including the length of time to code the algorithm in the restricted time.

Thoughts?

EDIT: By limited, I mean in the least amount of time possible.


Solution

  • The state-of-the-art prime factorization algorithm is the quadratic sieve and its variants. For numbers larger than 100 digits, the number sieve becomes more efficient.

    There's an open-source implementation of it here. It's able to factor a 100 digit number into two roughly equal primes in only 4 hours on a 2.2 GHz AMD Althon.

    So there's the algorithm and a sample implementation. That might be enough to give you ideas or get you started.