

"""simple docstring"""
A									=						{
    """0""": 1,
    """1""": 1,
    """2""": 2,
    """3""": 6,
    """4""": 24,
    """5""": 120,
    """6""": 720,
    """7""": 5040,
    """8""": 40320,
    """9""": 362880,
}

A									=						{145: 145}

A									=						{
    145: 0,
    169: 3,
    36301: 3,
    1454: 3,
    871: 2,
    45361: 2,
    872: 2,
}







def       UpperCamelCase_					(     lowerCamelCase							:					int   )						->     int:



       """simple docstring"""







       if n in CACHE_SUM_DIGIT_FACTORIALS:
              return CACHE_SUM_DIGIT_FACTORIALS[n]
       __magic_name__			:		List[Any]        =     sum(DIGIT_FACTORIALS[let] for let in str(lowerCamelCase   )   )
       __magic_name__			:		Optional[int]        =     ret
       return ret







def       UpperCamelCase_					(     lowerCamelCase							:					int     , lowerCamelCase							:					set | None = None   )						->     int:



       """simple docstring"""







       __magic_name__			:		Optional[Any]        =     previous or set()
       if n in CHAIN_LENGTH_CACHE:
              return CHAIN_LENGTH_CACHE[n]
       __magic_name__			:		Tuple        =     sum_digit_factorials(lowerCamelCase   )
       if next_number in previous:
              __magic_name__			:		Union[str, Any]        =     0
              return 0
       else:
              previous.add(lowerCamelCase   )
              __magic_name__			:		str        =     1 + chain_length(lowerCamelCase     , lowerCamelCase   )
              __magic_name__			:		Dict        =     ret
              return ret







def       UpperCamelCase_					(     lowerCamelCase							:					int = 60     , lowerCamelCase							:					int = 100_0000   )						->     int:



       """simple docstring"""







       return sum(1 for i in range(1     , lowerCamelCase   ) if chain_length(lowerCamelCase   ) == num_terms   )


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



"""simple docstring"""
import math







def       UpperCamelCase_					(     lowerCamelCase							:					int   )						->     list:



       """simple docstring"""







       if n <= 0:
              raise ValueError('''Only positive integers have prime factors'''   )
       __magic_name__			:		Union[str, Any]        =     []
       while n % 2 == 0:
              pf.append(2   )
              __magic_name__			:		Union[str, Any]        =     int(n / 2   )
       for i in range(3     , int(math.sqrt(lowerCamelCase   )   ) + 1     , 2   ):
              while n % i == 0:
                     pf.append(lowerCamelCase   )
                     __magic_name__			:		Any        =     int(n / i   )
       if n > 2:
              pf.append(lowerCamelCase   )
       return pf







def       UpperCamelCase_					(     lowerCamelCase							:					int   )						->     int:



       """simple docstring"""







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







def       UpperCamelCase_					(     lowerCamelCase							:					int   )						->     int:



       """simple docstring"""







       if n <= 0:
              raise ValueError('''Only positive numbers are accepted'''   )
       __magic_name__			:		int        =     1
       __magic_name__			:		Dict        =     1
       while n % 2 == 0:
              temp += 1
              __magic_name__			:		List[Any]        =     int(n / 2   )
       if temp > 1:
              s *= (2**temp - 1) / (2 - 1)
       for i in range(3     , int(math.sqrt(lowerCamelCase   )   ) + 1     , 2   ):
              __magic_name__			:		Any        =     1
              while n % i == 0:
                     temp += 1
                     __magic_name__			:		Any        =     int(n / i   )
              if temp > 1:
                     s *= (i**temp - 1) / (i - 1)
       return int(lowerCamelCase   )







def       UpperCamelCase_					(     lowerCamelCase							:					int   )						->     int:



       """simple docstring"""







       __magic_name__			:		str        =     n
       for x in set(prime_factors(lowerCamelCase   )   ):
              s *= (x - 1) / x
       return int(lowerCamelCase   )


if __name__ == "__main__":
 import doctest

 doctest.testmod()
