


"""simple docstring"""






from __future__ import annotations

import math
def 	lowerCamelCase			(	_UpperCamelCase						: int				)						->			bool:

							'''simple docstring'''



							if 1 < number < 4:
														# 2 and 3 are primes
														return True
							elif number < 2 or number % 2 == 0 or number % 3 == 0:
														# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
														return False

							# All primes number are in format of 6k +/- 1
							for i in range(5			,     int(math.sqrt(_UpperCamelCase				) + 1				)			,     6				):
														if number % i == 0 or number % (i + 2) == 0:
																					return False
							return True
def 	lowerCamelCase			(	_UpperCamelCase						: int				)						->			list[int]:

							'''simple docstring'''



							__UpperCAmelCase  :		Any 				=   str(_UpperCamelCase				)
							__UpperCAmelCase  :		Tuple 				=   [n]
							for i in range(1			,     len(_UpperCamelCase				)				):
														list_nums.append(int(str_num[i:]				)				)
														list_nums.append(int(str_num[:-i]				)				)
							return list_nums
def 	lowerCamelCase			(	_UpperCamelCase						: int				)						->			bool:

							'''simple docstring'''



							if len(str(_UpperCamelCase				)				) > 3:
														if not is_prime(int(str(_UpperCamelCase				)[-3:]				)				) or not is_prime(int(str(_UpperCamelCase				)[:3]				)				):
																					return False
							return True
def 	lowerCamelCase			(	_UpperCamelCase						: int = 1_1				)						->			list[int]:

							'''simple docstring'''



							__UpperCAmelCase  :		list[int] 				=   []
							__UpperCAmelCase  :		Any 				=   1_3
							while len(_UpperCamelCase				) != count:
														if validate(_UpperCamelCase				):
																					__UpperCAmelCase  :		Optional[Any] 				=   list_truncated_nums(_UpperCamelCase				)
																					if all(is_prime(_UpperCamelCase				) for i in list_nums				):
																												list_truncated_primes.append(_UpperCamelCase				)
														num += 2
							return list_truncated_primes
def 	lowerCamelCase			(	)						->			int:

							'''simple docstring'''



							return sum(compute_truncated_primes(1_1				)				)


if __name__ == "__main__":
							print(F"{sum(compute_truncated_primes(11)) = }")

from sympy import diff, lambdify, symbols
from sympy.functions import *  # noqa: F403




def    lowerCAmelCase_  (		lowercase:				str	,       lowercase:				complex	,       lowercase:				str = "x"	,       lowercase:				float = 10**-10	,       lowercase:				int = 1	,       )     ->					complex:







 '''simple docstring'''
 _UpperCamelCase:  Any    						=			symbols(lowercase		)
 _UpperCamelCase:  str    						=			lambdify(lowercase	,       lowercase		)
 _UpperCamelCase:  str    						=			lambdify(lowercase	,       diff(lowercase	,       lowercase		)		)

 _UpperCamelCase:  Optional[int]    						=			starting_point

 while True:
  if diff_function(lowercase		) != 0:
   _UpperCamelCase:  int    						=			prev_guess - multiplicity * func(lowercase		) / diff_function(
       lowercase		)
  else:
   raise ZeroDivisionError('''Could not find root'''		) from None

  # Precision is checked by comparing the difference of consecutive guesses
  if abs(next_guess - prev_guess		) < precision:
   return next_guess

  _UpperCamelCase:  Any    						=			next_guess


# 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
  # Find fourth Root of 5
  print(f"""The root of x**4 - 5 = 0 is {newton_raphson('x**4 -5', 0.4 +5J)}""")

  # Find value of e
  print(
      '''The root of log(y) - 1 = 0 is ''',
      f"""{newton_raphson('log(y) - 1', 2, variable='y')}""",
  )

  # Exponential Roots
  print(
      '''The root of exp(x) - 1 = 0 is''',
      f"""{newton_raphson('exp(x) - 1', 1_0, precision=0.0_0_5)}""",
  )

  # Find root of cos(x)
  print(f"""The root of cos(x) = 0 is {newton_raphson('cos(x)', 0)}""")