Algorithms for factoring integers