

"""simple docstring"""





_SCREAMING_SNAKE_CASE       :  Optional[Any]        = {
    """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,
}

_SCREAMING_SNAKE_CASE       :  Optional[int]        = {1_4_5: 1_4_5}

_SCREAMING_SNAKE_CASE       :  List[Any]        = {
    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        _lowerCAmelCase      (						UpperCAmelCase     :							int				):


					'''simple docstring'''






					if n in CACHE_SUM_DIGIT_FACTORIALS:
										return CACHE_SUM_DIGIT_FACTORIALS[n]
					UpperCamelCase__		:    List[Any]         =sum(DIGIT_FACTORIALS[let] for let in str(UpperCAmelCase				)				)
					UpperCamelCase__		:    List[Any]         =ret
					return ret



def        _lowerCAmelCase      (						UpperCAmelCase     :							int      ,							UpperCAmelCase     :							set | None = None				):


					'''simple docstring'''






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



def        _lowerCAmelCase      (						UpperCAmelCase     :							int = 60      ,							UpperCAmelCase     :							int = 1_000_000				):


					'''simple docstring'''






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


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





"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


_SCREAMING_SNAKE_CASE       :  Union[str, Any]        = {
    """configuration_xlm_prophetnet""": ["""XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMProphetNetConfig"""],
}

try:
				if not is_sentencepiece_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_SCREAMING_SNAKE_CASE       :  Any        = ["""XLMProphetNetTokenizer"""]

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_SCREAMING_SNAKE_CASE       :  Optional[Any]        = [
				    """XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """XLMProphetNetDecoder""",
				    """XLMProphetNetEncoder""",
				    """XLMProphetNetForCausalLM""",
				    """XLMProphetNetForConditionalGeneration""",
				    """XLMProphetNetModel""",
				    """XLMProphetNetPreTrainedModel""",
				]


if TYPE_CHECKING:
				from .configuration_xlm_prophetnet import XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMProphetNetConfig

				try:
								if not is_sentencepiece_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_xlm_prophetnet import XLMProphetNetTokenizer

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_xlm_prophetnet import (
								    XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
								    XLMProphetNetDecoder,
								    XLMProphetNetEncoder,
								    XLMProphetNetForCausalLM,
								    XLMProphetNetForConditionalGeneration,
								    XLMProphetNetModel,
								    XLMProphetNetPreTrainedModel,
								)

else:
				import sys

				_SCREAMING_SNAKE_CASE       :  Dict        = _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


