refactor code for problem 3 and also add new test for problem 3 to verify output type long  when calling the largestPrimeFactor