





_lowercase		:				Tuple      		=[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)]

def      lowerCAmelCase_					(  _lowercase    :       int)							->	int:







			"""simple docstring"""
			a__       :						Dict							=  0
			while number:
						# Increased Speed Slightly by checking every 5 digits together.
						sum_of_digits_squared += DIGITS_SQUARED[number % 10_0000]
						number //= 10_0000

			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
_lowercase		:				list[bool | None]      		=[None] * 1000_0000
_lowercase		:				Optional[Any]      		=True
_lowercase		:				int      		=False

def      lowerCAmelCase_					(  _lowercase    :       int)							->	bool:







			"""simple docstring"""

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

			a__       :						List[str]							=  chain(next_number(_UpperCAmelCase))
			a__       :						Optional[Any]							=  number_chain

			while number < 1000_0000:
						a__       :						Tuple							=  number_chain
						number *= 10

			return number_chain

def      lowerCAmelCase_					(  _lowercase    :       int = 1000_0000)							->	int:







			"""simple docstring"""
			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() = }')









import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
		import ctypes
		import msvcrt  # noqa

		class        snake_case__    (ctypes.Structure		):







								"""simple docstring"""




								__lowerCAmelCase					:Dict      =					[("size", ctypes.c_int), ("visible", ctypes.c_byte)]

def      lowerCAmelCase_					(  )							->	List[Any]:







			"""simple docstring"""
			if os.name == "nt":
						a__       :						int							=  CursorInfo()
						a__       :						Union[str, Any]							=  ctypes.windll.kernelaa.GetStdHandle(-11)
						ctypes.windll.kernelaa.GetConsoleCursorInfo(_lowercase						,       ctypes.byref(_lowercase))
						a__       :						List[str]							=  False
						ctypes.windll.kernelaa.SetConsoleCursorInfo(_lowercase						,       ctypes.byref(_lowercase))
			elif os.name == "posix":
						sys.stdout.write("""\033[?25l""")
						sys.stdout.flush()

def      lowerCAmelCase_					(  )							->	Optional[Any]:







			"""simple docstring"""
			if os.name == "nt":
						a__       :						List[Any]							=  CursorInfo()
						a__       :						Optional[int]							=  ctypes.windll.kernelaa.GetStdHandle(-11)
						ctypes.windll.kernelaa.GetConsoleCursorInfo(_lowercase						,       ctypes.byref(_lowercase))
						a__       :						Dict							=  True
						ctypes.windll.kernelaa.SetConsoleCursorInfo(_lowercase						,       ctypes.byref(_lowercase))
			elif os.name == "posix":
						sys.stdout.write("""\033[?25h""")
						sys.stdout.flush()





@contextmanager
def      lowerCAmelCase_					(  )							->	Any:







			"""simple docstring"""
			try:
						hide_cursor()
						yield
			finally:
						show_cursor()




