






"""simple docstring"""



_UpperCamelCase						:    Tuple		=						{
    '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						:    str		=						{1_4_5: 1_4_5}

_UpperCamelCase						:    Dict		=						{
    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 		_SCREAMING_SNAKE_CASE					(       __snake_case     :    int       ):





  '''simple docstring'''





  if n in CACHE_SUM_DIGIT_FACTORIALS:
    return CACHE_SUM_DIGIT_FACTORIALS[n]
  lowercase				       =			sum(DIGIT_FACTORIALS[let] for let in str(__snake_case       )       )
  lowercase				       =			ret
  return ret
def 		_SCREAMING_SNAKE_CASE					(       __snake_case     :    int						,   __snake_case     :    set | None = None       ):





  '''simple docstring'''





  lowercase				       =			previous or set()
  if n in CHAIN_LENGTH_CACHE:
    return CHAIN_LENGTH_CACHE[n]
  lowercase				       =			sum_digit_factorials(__snake_case       )
  if next_number in previous:
    lowercase				       =			0
    return 0
  else:
    previous.add(__snake_case       )
    lowercase				       =			1 + chain_length(__snake_case						,   __snake_case       )
    lowercase				       =			ret
    return ret
def 		_SCREAMING_SNAKE_CASE					(       __snake_case     :    int = 60						,   __snake_case     :    int = 1_00_00_00       ):





  '''simple docstring'''





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


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









from typing import TYPE_CHECKING

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


snake_case__   :				Tuple						=	{
    'configuration_realm': ['REALM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RealmConfig'],
    'tokenization_realm': ['RealmTokenizer'],
}

try:
       if not is_tokenizers_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       snake_case__   :				Tuple						=	['RealmTokenizerFast']

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       snake_case__   :				str						=	[
           'REALM_PRETRAINED_MODEL_ARCHIVE_LIST',
           'RealmEmbedder',
           'RealmForOpenQA',
           'RealmKnowledgeAugEncoder',
           'RealmPreTrainedModel',
           'RealmReader',
           'RealmScorer',
           'load_tf_weights_in_realm',
       ]
       snake_case__   :				Any						=	['RealmRetriever']


if TYPE_CHECKING:
       from .configuration_realm import REALM_PRETRAINED_CONFIG_ARCHIVE_MAP, RealmConfig
       from .tokenization_realm import RealmTokenizer

       try:
              if not is_tokenizers_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_realm import RealmTokenizerFast

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_realm import (
                  REALM_PRETRAINED_MODEL_ARCHIVE_LIST,
                  RealmEmbedder,
                  RealmForOpenQA,
                  RealmKnowledgeAugEncoder,
                  RealmPreTrainedModel,
                  RealmReader,
                  RealmScorer,
                  load_tf_weights_in_realm,
              )
              from .retrieval_realm import RealmRetriever


else:
       import sys

       snake_case__   :				Any						=	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)





