More efficient solution to problem 7

Uses a simplified isPrime function.
Solved problem 8