

'''simple docstring'''







from __future__ import annotations

import math
import random






def 					_SCREAMING_SNAKE_CASE		(						snake_case_							,       snake_case_							,       snake_case_	):
	_lowercase							=     d * e - 1
	_lowercase							=     0
	_lowercase							=     0
	while p == 0:
		_lowercase							=     random.randint(2							,       n - 1	)
		_lowercase							=     k
		while True:
			if t % 2 == 0:
				_lowercase							=     t // 2
				_lowercase							=     (g**t) % n
				_lowercase							=     math.gcd(x - 1							,       snake_case_	)
				if x > 1 and y > 1:
					_lowercase							=     y
					_lowercase							=     n // y
					break  # find the correct factors
			else:
				break  # t is not divisible by 2, break and choose another g
	return sorted([p, q]	)


if __name__ == "__main__":
							import doctest

							doctest.testmod()







'''simple docstring'''







from __future__ import annotations

from collections.abc import Generator






def 					_SCREAMING_SNAKE_CASE		(						snake_case_	):
	if not isinstance(snake_case_							,       snake_case_	) or n < 1:
		raise Exception("""Sequence only defined for positive integers"""	)

	yield n
	while n != 1:
		if n % 2 == 0:
			n //= 2
		else:
			_lowercase							=     3 * n + 1
		yield n






def 					_SCREAMING_SNAKE_CASE		(						):
	_lowercase							=     43
	_lowercase							=     tuple(collatz_sequence(snake_case_	)	)
	print(snake_case_	)
	print(F"""Collatz sequence from {n} took {len(snake_case_	)} steps."""	)


if __name__ == "__main__":
							main()




