only check up to sqrt(n) for divisors