




'''simple docstring'''






from __future__ import annotations

from collections.abc import Generator

def       __lowerCAmelCase (   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:
									__UpperCamelCase				:      List[Any]									=       3 * n + 1
						yield n

def       __lowerCAmelCase (   ):
			__UpperCamelCase				:      List[str]									=       43
			__UpperCamelCase				:      Optional[Any]									=       tuple(collatz_sequence(snake_case__						)						)
			print(snake_case__						)
			print(F"Collatz sequence from {n} took {len(snake_case__						)} steps."						)


if __name__ == "__main__":
				main()









'''simple docstring'''






def       __lowerCAmelCase (   snake_case__ = 4_000_000						):
			__UpperCamelCase				:      Tuple									=       1
			__UpperCamelCase				:      int									=       2
			__UpperCamelCase				:      str									=       0
			while j <= n:
						if j % 2 == 0:
									total += j
						__UpperCamelCase		, __UpperCamelCase				:      List[Any]									=       j, i + j

			return total


if __name__ == "__main__":
				print(f'{solution() = }')



