
"""simple docstring"""

from collections.abc import Callable






def 							A						(    snake_case				:Callable[[float], float]    , snake_case				:float    , snake_case				:float		)				->     float:
 __UpperCamelCase      =	a
 __UpperCamelCase      =	b
 if function(snake_case		) == 0:  # one of the a or b is a root for the function
  return a
 elif function(snake_case		) == 0:
  return b
 elif (
     function(snake_case		) * function(snake_case		) > 0
 ):  # if none of these are root and they are both positive or negative,
  # then this algorithm can't find the root
  raise ValueError('could not find root in given interval.'		)
 else:
  __UpperCamelCase      =	start + (end - start) / 2.0
  while abs(start - mid		) > 1_0**-7:  # until precisely equals to 10^-7
   if function(snake_case		) == 0:
    return mid
   elif function(snake_case		) * function(snake_case		) < 0:
    __UpperCamelCase      =	mid
   else:
    __UpperCamelCase      =	mid
   __UpperCamelCase      =	start + (end - start) / 2.0
  return mid






def 							A						(    snake_case				:float		)				->     float:
 return x**3 - 2 * x - 5


if __name__ == "__main__":
      print(bisection(f, 1, 1_0_0_0))

      import doctest

      doctest.testmod()





"""simple docstring"""

from math import isqrt






def 							A						(    snake_case				:int		)				->     list[int]:
 __UpperCamelCase      =	[True] * max_number
 for i in range(2    , isqrt(max_number - 1		) + 1		):
  if is_prime[i]:
   for j in range(i**2    , snake_case    , snake_case		):
    __UpperCamelCase      =	False

 return [i for i in range(2    , snake_case		) if is_prime[i]]






def 							A						(    snake_case				:int = 1_0**8		)				->     int:
 __UpperCamelCase      =	calculate_prime_numbers(max_number // 2		)

 __UpperCamelCase      =	0
 __UpperCamelCase      =	0
 __UpperCamelCase      =	len(snake_case		) - 1
 while left <= right:
  while prime_numbers[left] * prime_numbers[right] >= max_number:
   right -= 1
  semiprimes_count += right - left + 1
  left += 1

 return semiprimes_count


if __name__ == "__main__":
      print(f'''{solution() = }''')



