More prime functionality.
Solution for problem 10.