def _sqrt_nearest(n, a):
 if ((n <= 0) or (a <= 0)):
  raise ValueError('Both arguments to _sqrt_nearest should be positive.')
 b = 0
 while (a != b):
  (b, a) = (a, ((a - ((- n) // a)) >> 1))
 return a

def _sqrt_nearest ( n , a ) : if ( ( n <= 0 ) or ( a <= 0 ) ) : raise ValueError ( 'Both arguments to _sqrt_nearest should be positive.' ) b = 0 while ( a != b ) : ( b , a ) = ( a , ( ( a - ( ( - n ) // a ) ) >> 1 ) ) return a
closest integer to the square root of the positive integer n .