Implement factorization using trial division using primes

This implements Eratosthenes sieve and then implements factorization using the primes from it.

This implementation allows to factor pretty large numbers, up to 1e10 or even more. Once we interface primesieve, it will get even faster.

@thilinarmtb --- would you mind reviewing this PR?