How can I optimize this factorization algorithm on scratch?

Posted by Expert-Wave7338@reddit | learnprogramming | View on Reddit | 11 comments

I recently wrote a program which uses the a simple factorization approach ((x-1)| n , (x+1)|n when x\^2 == 1 mod n , of course excluding trivial factors); given that this runs \~ O(n), is there an effective way to implement a sieve which does not rely on Gaussian elimination?