multi-threaded factorize