Fixed problem 3 to avoid non prime divisors