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






def 					SCREAMING_SNAKE_CASE_			(		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()

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




from __future__ import annotations

UpperCAmelCase							=       "Alexander Joslin"






def 					SCREAMING_SNAKE_CASE_			(		lowerCAmelCase_: int     ):

      if number <= 0:
            snake_case_     :			Dict       =       f"n must be greater than 0. Got n = {number}"
            raise ValueError(lowerCAmelCase_     )

      snake_case_     :			Tuple       =       [number + 1] * (number + 1)

      # starting position
      snake_case_     :			Union[str, Any]       =       0
      for i in range(1 ,	lowerCAmelCase_     ):
            snake_case_     :			int       =       min(table[i + 1] ,	table[i] + 1     )
            # check if out of bounds
            if i * 2 <= number:
                  snake_case_     :			Tuple       =       min(table[i * 2] ,	table[i] + 1     )
            # check if out of bounds
            if i * 3 <= number:
                  snake_case_     :			Dict       =       min(table[i * 3] ,	table[i] + 1     )
      return table[number]


if __name__ == "__main__":
     import doctest

     doctest.testmod()



