Repurposed the is_prime function from Problem 3 for Problem 10. Quick and dirty solution, but was pretty fast.