



'''simple docstring'''
snake_case_			:     Tuple  	=  [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)]






def A__   (					UpperCAmelCase_							):
      _UpperCamelCase :		Tuple			    =       0
      while number:
            # Increased Speed Slightly by checking every 5 digits together.
            sum_of_digits_squared += DIGITS_SQUARED[number % 1_0_0_0_0_0]
            number //= 1_0_0_0_0_0

      return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
snake_case_			:     list[bool | None]  	=  [None] * 10000000
snake_case_			:     List[str]  	=  True
snake_case_			:     Optional[Any]  	=  False






def A__   (					UpperCAmelCase_							):

      if CHAINS[number - 1] is not None:
            return CHAINS[number - 1]  # type: ignore

      _UpperCamelCase :		List[str]			    =       chain(next_number(UpperCAmelCase_							)							)
      _UpperCamelCase :		List[Any]			    =       number_chain

      while number < 1_0_0_0_0_0_0_0:
            _UpperCamelCase :		str			    =       number_chain
            number *= 1_0

      return number_chain






def A__   (					UpperCAmelCase_ = 1_0_0_0_0_0_0_0							):
      for i in range(1  ,  UpperCAmelCase_							):
            if CHAINS[i] is None:
                  chain(i + 1							)

      return CHAINS[:number].count(UpperCAmelCase_							)


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     print(F"""{solution() = }""")







'''simple docstring'''
from typing import TYPE_CHECKING

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


snake_case_			:     Any  	=  {
    'configuration_gpt_neox_japanese': ['GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTNeoXJapaneseConfig'],
    'tokenization_gpt_neox_japanese': ['GPTNeoXJapaneseTokenizer'],
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     Optional[int]  	=  [
					    'GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'GPTNeoXJapaneseForCausalLM',
					    'GPTNeoXJapaneseLayer',
					    'GPTNeoXJapaneseModel',
					    'GPTNeoXJapanesePreTrainedModel',
					]


if TYPE_CHECKING:
					from .configuration_gpt_neox_japanese import GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTNeoXJapaneseConfig
					from .tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_gpt_neox_japanese import (
										    GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST,
										    GPTNeoXJapaneseForCausalLM,
										    GPTNeoXJapaneseLayer,
										    GPTNeoXJapaneseModel,
										    GPTNeoXJapanesePreTrainedModel,
										)


else:
					import sys

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


