Adding solution to problem 10 and extracting primality checking functionality as its used in 3 places now