



"""simple docstring"""




_UpperCamelCase:					str     				=	{
    '0': 1,
    '1': 1,
    '2': 2,
    '3': 6,
    '4': 2_4,
    '5': 1_2_0,
    '6': 7_2_0,
    '7': 5_0_4_0,
    '8': 4_0_3_2_0,
    '9': 3_6_2_8_8_0,
}

_UpperCamelCase:					List[Any]     				=	{1_4_5: 1_4_5}

_UpperCamelCase:					Tuple     				=	{
    1_4_5: 0,
    1_6_9: 3,
    3_6_3_0_1: 3,
    1_4_5_4: 3,
    8_7_1: 2,
    4_5_3_6_1: 2,
    8_7_2: 2,
}


def 	lowercase__  (      _UpperCAmelCase					)  ->      List[str]:






      '''simple docstring'''


      if n in CACHE_SUM_DIGIT_FACTORIALS:
            return CACHE_SUM_DIGIT_FACTORIALS[n]
      lowercase	:   Union[str, Any]											= sum(DIGIT_FACTORIALS[let] for let in str(_a					)					)
      lowercase	:   Any											= ret
      return ret


def 	lowercase__  (      _UpperCAmelCase						,   _UpperCAmelCase = None					)  ->      Optional[Any]:






      '''simple docstring'''


      lowercase	:   Dict											= previous or set()
      if n in CHAIN_LENGTH_CACHE:
            return CHAIN_LENGTH_CACHE[n]
      lowercase	:   List[Any]											= sum_digit_factorials(_a					)
      if next_number in previous:
            lowercase	:   int											= 0
            return 0
      else:
            previous.add(_a					)
            lowercase	:   Optional[Any]											= 1 + chain_length(_a						,   _a					)
            lowercase	:   Any											= ret
            return ret


def 	lowercase__  (      _UpperCAmelCase = 60						,   _UpperCAmelCase = 1_00_00_00					)  ->      Dict:






      '''simple docstring'''


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


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





import math







def       lowerCamelCase_  (    _a       :						int    ):



    '''simple docstring'''




    if 1 < number < 4:
        # 2 and 3 are primes
        return True
    elif number < 2 or number % 2 == 0 or number % 3 == 0:
        # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
        return False

    # All primes number are in format of 6k +/- 1
    for i in range(5   ,		int(math.sqrt(_a    ) + 1    )   ,		6    ):
        if number % i == 0 or number % (i + 2) == 0:
            return False
    return True







def       lowerCamelCase_  (    _a       :						int = 6008_5147_5143    ):



    '''simple docstring'''




    try:
        UpperCAmelCase_     :       str  		=					int(_a    )
    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."""    )
    UpperCAmelCase_     :       Optional[int]  		=					0
    if is_prime(_a    ):
        return n
    while n % 2 == 0:
        n //= 2
    if is_prime(_a    ):
        return n
    for i in range(3   ,		int(math.sqrt(_a    )    ) + 1   ,		2    ):
        if n % i == 0:
            if is_prime(n // i    ):
                UpperCAmelCase_     :       Optional[int]  		=					n // i
                break
            elif is_prime(_a    ):
                UpperCAmelCase_     :       str  		=					i
    return max_number


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