Refactored Integer#prime? and added test cases.