






from __future__ import annotations

from collections.abc import Generator


def __A       ( __lowerCAmelCase      )->    Generator[int, None, None]:





						"""simple docstring"""



						if not isinstance(__lowerCAmelCase					,						__lowerCAmelCase      ) or n < 1:
												raise Exception('Sequence only defined for positive integers'      )

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


def __A       ( )->    Union[str, Any]:





						"""simple docstring"""



						_UpperCAmelCase							   =     43
						_UpperCAmelCase							   =     tuple(collatz_sequence(__lowerCAmelCase      )      )
						print(__lowerCAmelCase      )
						print(F"""Collatz sequence from {n} took {len(__lowerCAmelCase      )} steps."""      )


if __name__ == "__main__":
		main()








def __A       ( __lowerCAmelCase = 100					,						__lowerCAmelCase = 100      )->    int:





						"""simple docstring"""



						return max(
						    sum(int(__lowerCAmelCase      ) for x in str(base**power      )      )
						    for base in range(__lowerCAmelCase      )
						    for power in range(__lowerCAmelCase      )      )


# Tests
if __name__ == "__main__":
		import doctest

		doctest.testmod()
