reworked prime factorization