upgraded primeFactorsOf function to a much faster new version