double iteration is now done to factorize into two primes