solution for problem if only prime divisors wanted