def find_nearest_n(number): left = 0 right = number while right-left >= 0.01: if ((left+right)/2)**2 == number: return (left+right)/2 elif ((left+right)/2)**2 > number: right = (left+right)/2 else: left = (left+right)/2 if int(right) > int(left): return int(right) elif left - int(left) < 0.5: return int(left) else: return int(left)+1