Problem 45
Very slow solution for Problem 50
Added isPrime function