
import itertools




def 						A_			(				snake_case				: int = 1000000			)   ->     int:



						'''simple docstring'''

						__UpperCamelCase  	=      [1]

						for i in itertools.count(len(snake_case			)			):
												__UpperCamelCase  	=      0
												for j in itertools.count(1			):
																		__UpperCamelCase  	=      -1 if j % 2 == 0 else +1
																		__UpperCamelCase  	=      (j * j * 3 - j) // 2
																		if index > i:
																								break
																		item += partitions[i - index] * sign
																		item %= number
																		index += j
																		if index > i:
																								break
																		item += partitions[i - index] * sign
																		item %= number

												if item == 0:
																		return i
												partitions.append(snake_case			)

						return 0


if __name__ == "__main__":
				import doctest

				doctest.testmod()

				print(F"{solution() = }")









'''simple docstring'''






import math as m





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     Union[str, Any] ,       snake_case_    :     int ,       snake_case_    :     Optional[Any]=0.0_0_1  )		->Tuple:






							'''simple docstring'''
							return (f(a + h  ) - f(a - h  )) / (2 * h)





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     Dict ,       snake_case_    :     List[Any]=0 ,       snake_case_    :     Dict=1_00 ,       snake_case_    :     List[str]=0.0_0_0_1 ,       snake_case_    :     str=1E-6 ,       snake_case_    :     Tuple=False  )		->List[Any]:






							'''simple docstring'''
							_lowercase							:		Tuple				=   xa  # set the initial guess
							_lowercase							:		List[str]				=   [a]
							_lowercase							:		str				=   abs(f(snake_case_  )  )
							_lowercase							:		Dict				=   lambda snake_case_  : calc_derivative(snake_case_ ,       snake_case_ ,       h=snake_case_  )  # noqa: E731  Derivative of f(x)
							for _ in range(snake_case_  ):
														if fa(snake_case_  ) == 0:
																					raise ValueError('''No converging solution found'''  )
														_lowercase							:		Tuple				=   a - f(snake_case_  ) / fa(snake_case_  )  # Calculate the next estimate
														if logsteps:
																					steps.append(snake_case_  )
														if error < maxerror:
																					break
							else:
														raise ValueError('''Iteration limit reached, no converging solution found'''  )
							if logsteps:
														# If logstep is true, then log intermediate steps
														return a, error, steps
							return a, error


if __name__ == "__main__":
						from matplotlib import pyplot as plt

						lowerCamelCase__	  =		lambda x: m.tanh(x) ** 2 - m.exp(3 * x)  # noqa: E731
						lowerCamelCase__  ,      lowerCamelCase__  ,      lowerCamelCase__	  =		newton_raphson(
						    f, xa=10, maxiter=10_00, step=1e-6, logsteps=True
						)
						plt.plot([abs(f(x)) for x in steps])
						plt.xlabel('step')
						plt.ylabel('error')
						plt.show()
						print(f'''solution = {{{solution:f}}}, error = {{{error:f}}}''')



