


"""simple docstring"""







a__							:				int          =	[sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)]




def   UpperCAmelCase__			(lowerCAmelCase_  ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		  =							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
a__							:				Optional[Any]          =	[None] * 1_0_0_0_0_0_0_0
a__							:				int          =	True
a__							:				int          =	False




def   UpperCAmelCase__			(lowerCAmelCase_  ):




					'''simple docstring'''


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

					__SCREAMING_SNAKE_CASE		  =							chain(next_number(__lowerCAmelCase  )  )
					__SCREAMING_SNAKE_CASE		  =							number_chain

					while number < 1000_0000:
										__SCREAMING_SNAKE_CASE		  =							number_chain
										number *= 10

					return number_chain




def   UpperCAmelCase__			(lowerCAmelCase_ = 1000_0000  ):




					'''simple docstring'''


					for i in range(1    ,		__lowerCAmelCase  ):
										if CHAINS[i] is None:
															chain(i + 1  )

					return CHAINS[:number].count(__lowerCAmelCase  )


if __name__ == "__main__":
		import doctest

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







'''simple docstring'''




def 	__lowerCamelCase			(      __lowerCAmelCase       :							int		)		->  int:
   assert isinstance(__lowerCAmelCase      ,    __lowerCAmelCase		), F'''The input value of [n={number}] is not an integer'''

   if number == 1:
      return 2
   elif number < 1:
      snake_case 						=   F'''The input value of [n={number}] has to be > 0'''
      raise ValueError(__lowerCAmelCase		)
   else:
      snake_case 						=   sylvester(number - 1		)
      snake_case 						=   num - 1
      snake_case 						=   num
      return lower * upper + 1


if __name__ == "__main__":
 print(F"""The 8th number in Sylvester's sequence: {sylvester(8)}""")

