Skip to content

Factorization algorithm

David Hofer edited this page Apr 20, 2016 · 3 revisions

The algorithm for factoring a number n as I've implemented it goes something like the following.

  • Trial division. Using a precomputed number of primes (currently all those less than 1 million), test if any divide n. If so, add them as factors, divide n by them, and continue

  • Perfect power test. Details here: https://github.com/dkhofer/primes/wiki/Finding-perfect-powers

  • Pollard's Rho algorithm.

  • Brute force

Clone this wiki locally