


"""simple docstring"""






def __lowercase  (   lowerCamelCase_	:   int	):
				if number != int(lowerCamelCase_	):
								raise ValueError("factorial() only accepts integral values"	)
				if number < 0:
								raise ValueError("factorial() not defined for negative values"	)
				SCREAMING_SNAKE_CASE__  				=					1
				for i in range(1    ,       number + 1	):
								value *= i
				return value


def __lowercase  (   lowerCamelCase_	:   int	):
				if not isinstance(lowerCamelCase_    ,       lowerCamelCase_	):
								raise ValueError("factorial() only accepts integral values"	)
				if n < 0:
								raise ValueError("factorial() not defined for negative values"	)
				return 1 if n == 0 or n == 1 else n * factorial(n - 1	)


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	_lowerCamelCase  =	int(input('Enter a positive integer: ').strip() or 0)
	print(f"""factorial{n} is {factorial(n)}""")




"""simple docstring"""






from __future__ import annotations

from collections.abc import Generator


def __lowercase  (   lowerCamelCase_	:   int	):
				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:
												SCREAMING_SNAKE_CASE__  				=					3 * n + 1
								yield n


def __lowercase  (   ):
				SCREAMING_SNAKE_CASE__  				=					43
				SCREAMING_SNAKE_CASE__  				=					tuple(collatz_sequence(lowerCamelCase_	)	)
				print(lowerCamelCase_	)
				print(F'''Collatz sequence from {n} took {len(lowerCamelCase_	)} steps.'''	)


if __name__ == "__main__":
	main()
