
"""simple docstring"""




from __future__ import annotations

from decimal import Decimal
from math import *  # noqa: F403

from sympy import diff



def 							a__ (				lowerCAmelCase	:       str       ,    lowerCAmelCase	:       float | Decimal       ,    lowerCAmelCase	:       float = 10**-10		):






     '''simple docstring'''
     UpperCAmelCase__							: str 							=						a
     while True:
          UpperCAmelCase__							: Tuple 							=						Decimal(lowerCAmelCase		) - (
              Decimal(eval(lowerCAmelCase		)		) / Decimal(eval(str(diff(lowerCAmelCase		)		)		)		)  # noqa: S307
          )
          # This number dictates the accuracy of the answer
          if abs(eval(lowerCAmelCase		)		) < precision:  # noqa: S307
               return float(lowerCAmelCase		)


# Let's Execute
if __name__ == "__main__":
    # Find root of trigonometric function
    # Find value of pi
    print(f"""The root of sin(x) = 0 is {newton_raphson("sin(x)", 2)}""")
    # Find root of polynomial
    print(f"""The root of x**2 - 5*x + 2 = 0 is {newton_raphson("x**2 - 5*x + 2", 0.4)}""")
    # Find Square Root of 5
    print(f"""The root of log(x) - 1 = 0 is {newton_raphson("log(x) - 1", 2)}""")
    # Exponential Roots
    print(f"""The root of exp(x) - 1 = 0 is {newton_raphson("exp(x) - 1", 0)}""")





"""simple docstring"""




from math import isqrt



def 							a__ (				lowerCAmelCase	:       int		):






     '''simple docstring'''
     UpperCAmelCase__							: Tuple 							=						[True] * max_number
     for i in range(2       ,    isqrt(max_number - 1		) + 1		):
          if is_prime[i]:
               for j in range(i**2       ,    lowerCAmelCase       ,    lowerCAmelCase		):
                    UpperCAmelCase__							: List[Any] 							=						False

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



def 							a__ (				lowerCAmelCase	:       int = 10**8		):






     '''simple docstring'''
     UpperCAmelCase__							: Dict 							=						calculate_prime_numbers(max_number // 2		)

     UpperCAmelCase__							: Optional[int] 							=						0
     UpperCAmelCase__							: Optional[int] 							=						0
     UpperCAmelCase__							: Tuple 							=						len(lowerCAmelCase		) - 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() = }""")



