big update to prime factorization code.