Solution to problem 3, finding the largest prime factor of a number n