

"""simple docstring"""


import math






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			list:
		if n <= 0:
				raise ValueError("Only positive integers have prime factors"				)
		__lowerCAmelCase: Tuple					   =    []
		while n % 2 == 0:
				pf.append(2				)
				__lowerCAmelCase: str					   =    int(n / 2				)
		for i in range(3      ,				int(math.sqrt(__SCREAMING_SNAKE_CASE				)				) + 1      ,				2				):
				while n % i == 0:
						pf.append(__SCREAMING_SNAKE_CASE				)
						__lowerCAmelCase: List[Any]					   =    int(n / i				)
		if n > 2:
				pf.append(__SCREAMING_SNAKE_CASE				)
		return pf






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			int:
		if n <= 0:
				raise ValueError("Only positive numbers are accepted"				)
		__lowerCAmelCase: int					   =    1
		__lowerCAmelCase: str					   =    1
		while n % 2 == 0:
				temp += 1
				__lowerCAmelCase: Dict					   =    int(n / 2				)
		div *= temp
		for i in range(3      ,				int(math.sqrt(__SCREAMING_SNAKE_CASE				)				) + 1      ,				2				):
				__lowerCAmelCase: int					   =    1
				while n % i == 0:
						temp += 1
						__lowerCAmelCase: Tuple					   =    int(n / i				)
				div *= temp
		if n > 1:
				div *= 2
		return div






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			int:
		if n <= 0:
				raise ValueError("Only positive numbers are accepted"				)
		__lowerCAmelCase: Dict					   =    1
		__lowerCAmelCase: int					   =    1
		while n % 2 == 0:
				temp += 1
				__lowerCAmelCase: Tuple					   =    int(n / 2				)
		if temp > 1:
				s *= (2**temp - 1) / (2 - 1)
		for i in range(3      ,				int(math.sqrt(__SCREAMING_SNAKE_CASE				)				) + 1      ,				2				):
				__lowerCAmelCase: List[Any]					   =    1
				while n % i == 0:
						temp += 1
						__lowerCAmelCase: List[str]					   =    int(n / i				)
				if temp > 1:
						s *= (i**temp - 1) / (i - 1)
		return int(__SCREAMING_SNAKE_CASE				)






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			int:
		__lowerCAmelCase: Optional[int]					   =    n
		for x in set(prime_factors(__SCREAMING_SNAKE_CASE				)				):
				s *= (x - 1) / x
		return int(__SCREAMING_SNAKE_CASE				)


if __name__ == "__main__":
			import doctest

			doctest.testmod()





"""simple docstring"""


from __future__ import annotations






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			tuple[float, float]:
		assert (
		    c % greatest_common_divisor(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				) == 0
		)  # greatest_common_divisor(a,b) function implemented below
		((__lowerCAmelCase)   ,				(__lowerCAmelCase)   ,				(__lowerCAmelCase)): Dict					   =    extended_gcd(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)  # extended_gcd(a,b) function implemented below
		__lowerCAmelCase: Optional[int]					   =    c / d
		return (r * x, r * y)






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE = 2				)			->			None:
		((__lowerCAmelCase)   ,				(__lowerCAmelCase)): Optional[Any]					   =    diophantine(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)  # Initial value
		__lowerCAmelCase: Optional[Any]					   =    greatest_common_divisor(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)
		__lowerCAmelCase: Any					   =    a // d
		__lowerCAmelCase: str					   =    b // d

		for i in range(__SCREAMING_SNAKE_CASE				):
				__lowerCAmelCase: Dict					   =    xa + i * q
				__lowerCAmelCase: List[str]					   =    ya - i * p
				print(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			int:
		if a < b:
				__lowerCAmelCase   ,				__lowerCAmelCase: Any					   =    b, a

		while a % b != 0:
				__lowerCAmelCase   ,				__lowerCAmelCase: List[Any]					   =    b, a % b

		return b






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			tuple[int, int, int]:
		assert a >= 0 and b >= 0

		if b == 0:
				__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase: List[str]					   =    a, 1, 0
		else:
				((__lowerCAmelCase)   ,				(__lowerCAmelCase)   ,				(__lowerCAmelCase)): Dict					   =    extended_gcd(__SCREAMING_SNAKE_CASE      ,				a % b				)
				__lowerCAmelCase: Dict					   =    q
				__lowerCAmelCase: int					   =    p - q * (a // b)

		assert a % d == 0 and b % d == 0
		assert d == a * x + b * y

		return (d, x, y)


if __name__ == "__main__":
			from doctest import testmod

			testmod(name="diophantine", verbose=True)
			testmod(name="diophantine_all_soln", verbose=True)
			testmod(name="extended_gcd", verbose=True)
			testmod(name="greatest_common_divisor", verbose=True)


