




from __future__ import annotations

_UpperCAmelCase				:	str    						=    'Alexander Joslin'






def    UpperCAmelCase__	(						lowerCamelCase  : int						):

   if number <= 0:
      lowerCamelCase											=f'''n must be greater than 0. Got n = {number}'''
      raise ValueError(lowerCamelCase						)

   lowerCamelCase											=[number + 1] * (number + 1)

   # starting position
   lowerCamelCase											=0
   for i in range(1 ,lowerCamelCase						):
      lowerCamelCase											=min(table[i + 1] ,table[i] + 1						)
      # check if out of bounds
      if i * 2 <= number:
         lowerCamelCase											=min(table[i * 2] ,table[i] + 1						)
      # check if out of bounds
      if i * 3 <= number:
         lowerCamelCase											=min(table[i * 3] ,table[i] + 1						)
   return table[number]


if __name__ == "__main__":
   import doctest

   doctest.testmod()







import math
from decimal import Decimal, getcontext






def    UpperCAmelCase__	(						lowerCamelCase  : int = 4_00_00_00						):

   try:
      lowerCamelCase											=int(lowerCamelCase						)
   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											=1_00
   lowerCamelCase											=(Decimal(5						) ** Decimal(0.5						) + 1) / Decimal(2						)

   lowerCamelCase											=(math.floor(math.log(n * (phi + 2) ,lowerCamelCase						) - 1						) // 3) * 3 + 2
   lowerCamelCase											=Decimal(round(phi ** Decimal(index + 1						)						)						) / (phi + 2)
   lowerCamelCase											=num // 2
   return int(lowerCamelCase						)


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