checking only divisors less than square root