Checking to see if a number is a solution