added solution to distinct primes factors