


import math
from decimal import Decimal, getcontext




def 			a_   (					SCREAMING_SNAKE_CASE__      :   int = 4_000_000  ):
       '''simple docstring'''





       try:
              _lowerCamelCase :	Union[str, Any]						=int(SCREAMING_SNAKE_CASE__  )
       except (TypeError, ValueError):
              raise TypeError('Parameter n must be int or castable to int.'  )
       if n <= 0:
              raise ValueError('Parameter n must be greater than or equal to one.'  )
       _lowerCamelCase :	Union[str, Any]						=100
       _lowerCamelCase :	str						=(Decimal(5  ) ** Decimal(0.5  ) + 1) / Decimal(2  )

       _lowerCamelCase :	List[Any]						=(math.floor(math.log(n * (phi + 2)	,    SCREAMING_SNAKE_CASE__  ) - 1  ) // 3) * 3 + 2
       _lowerCamelCase :	List[Any]						=Decimal(round(phi ** Decimal(index + 1  )  )  ) / (phi + 2)
       _lowerCamelCase :	Dict						=num // 2
       return int(SCREAMING_SNAKE_CASE__  )


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






from __future__ import annotations

from collections.abc import Generator




def 			a_   (					SCREAMING_SNAKE_CASE__      :   int  ):
       '''simple docstring'''





       if not isinstance(SCREAMING_SNAKE_CASE__	,    SCREAMING_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:
                     _lowerCamelCase :	Optional[int]						=3 * n + 1
              yield n




def 			a_   (					):
       '''simple docstring'''





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


if __name__ == "__main__":
 main()


