

import math

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int       )      ->				list:
				if n <= 0:
								raise ValueError("Only positive integers have prime factors"       )
				_UpperCAmelCase				:						Union[str, Any]       						=			[]
				while n % 2 == 0:
								pf.append(2       )
								_UpperCAmelCase				:						Tuple       						=			int(n / 2       )
				for i in range(3     ,					int(math.sqrt(lowerCAmelCase       )       ) + 1     ,					2       ):
								while n % i == 0:
												pf.append(lowerCAmelCase       )
												_UpperCAmelCase				:						Optional[int]       						=			int(n / i       )
				if n > 2:
								pf.append(lowerCAmelCase       )
				return pf

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int       )      ->				int:
				if n <= 0:
								raise ValueError("Only positive numbers are accepted"       )
				_UpperCAmelCase				:						Dict       						=			1
				_UpperCAmelCase				:						str       						=			1
				while n % 2 == 0:
								temp += 1
								_UpperCAmelCase				:						List[str]       						=			int(n / 2       )
				div *= temp
				for i in range(3     ,					int(math.sqrt(lowerCAmelCase       )       ) + 1     ,					2       ):
								_UpperCAmelCase				:						Any       						=			1
								while n % i == 0:
												temp += 1
												_UpperCAmelCase				:						Any       						=			int(n / i       )
								div *= temp
				if n > 1:
								div *= 2
				return div

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int       )      ->				int:
				if n <= 0:
								raise ValueError("Only positive numbers are accepted"       )
				_UpperCAmelCase				:						Optional[Any]       						=			1
				_UpperCAmelCase				:						Union[str, Any]       						=			1
				while n % 2 == 0:
								temp += 1
								_UpperCAmelCase				:						Optional[Any]       						=			int(n / 2       )
				if temp > 1:
								s *= (2**temp - 1) / (2 - 1)
				for i in range(3     ,					int(math.sqrt(lowerCAmelCase       )       ) + 1     ,					2       ):
								_UpperCAmelCase				:						List[str]       						=			1
								while n % i == 0:
												temp += 1
												_UpperCAmelCase				:						List[Any]       						=			int(n / i       )
								if temp > 1:
												s *= (i**temp - 1) / (i - 1)
				return int(lowerCAmelCase       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int       )      ->				int:
				_UpperCAmelCase				:						Any       						=			n
				for x in set(prime_factors(lowerCAmelCase       )       ):
								s *= (x - 1) / x
				return int(lowerCAmelCase       )


if __name__ == "__main__":
					import doctest

					doctest.testmod()





from __future__ import annotations

SCREAMING_SNAKE_CASE_						=					'Alexander Joslin'

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int       )      ->				int:

				if number <= 0:
								_UpperCAmelCase				:						Optional[Any]       						=			F'n must be greater than 0. Got n = {number}'
								raise ValueError(lowerCAmelCase       )

				_UpperCAmelCase				:						Dict       						=			[number + 1] * (number + 1)

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


if __name__ == "__main__":
					import doctest

					doctest.testmod()


