more efficient algorithm for intSqrt