



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

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:int				)  ->     int:
   _A      =       0
   while number:
      # Increased Speed Slightly by checking every 5 digits together.
      sum_of_digits_squared += DIGITS_SQUARED[number % 100_000]
      number //= 100_000

   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
UpperCAmelCase_		 =					[None] * 1_0_0_0_0_0_0_0
UpperCAmelCase_		 =					True
UpperCAmelCase_		 =					False

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:int				)  ->     bool:

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

   _A      =       chain(next_number(_snake_case				)				)
   _A      =       number_chain

   while number < 10_000_000:
      _A      =       number_chain
      number *= 10

   return number_chain

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:int = 10_000_000				)  ->     int:
   for i in range(1	,   _snake_case				):
      if CHAINS[i] is None:
         chain(i + 1				)

   return CHAINS[:number].count(_snake_case				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   print(f'{solution() = }')







'''simple docstring'''

import unittest

import numpy as np

def _SCREAMING_SNAKE_CASE (A    ,					A    ,					A    ,					A = None    ,					)			->			np.ndarray:






       """simple docstring"""







       lowercase__      =					np.shape(A			)
       lowercase__      =					np.shape(A			)
       lowercase__      =					np.shape(A			)

       if shape_a[0] != shape_b[0]:
              lowercase__      =					(
                  '''Expected the same number of rows for A and B. '''
                  f"Instead found A of size {shape_a} and B of size {shape_b}"
              )
              raise ValueError(A			)

       if shape_b[1] != shape_c[1]:
              lowercase__      =					(
                  '''Expected the same number of columns for B and C. '''
                  f"Instead found B of size {shape_b} and C of size {shape_c}"
              )
              raise ValueError(A			)

       lowercase__      =					pseudo_inv
       if a_inv is None:
              try:
                     lowercase__      =					np.linalg.inv(A			)
              except np.linalg.LinAlgError:
                     raise ValueError(
                         '''Input matrix A is not invertible. Cannot compute Schur complement.'''			)

       return mat_c - mat_b.T @ a_inv @ mat_b
class     __lowerCAmelCase		(unittest.TestCase	):





      '''simple docstring'''






      def  UpperCamelCase__						(self       :       Dict					):

             '''simple docstring'''







             lowercase__      =					np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]					)
             lowercase__      =					np.array([[0, 3], [3, 0], [2, 3]]					)
             lowercase__      =					np.array([[2, 1], [6, 3]]					)

             lowercase__      =					schur_complement(UpperCamelCase  ,		UpperCamelCase  ,		UpperCamelCase					)

             lowercase__      =					np.block([[a, b], [b.T, c]]					)

             lowercase__      =					np.linalg.det(UpperCamelCase					)
             lowercase__      =					np.linalg.det(UpperCamelCase					)
             lowercase__      =					np.linalg.det(UpperCamelCase					)

             self.assertAlmostEqual(UpperCamelCase  ,		det_a * det_s					)



      def  UpperCamelCase__						(self       :       Optional[int]					):

             '''simple docstring'''







             lowercase__      =					np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]					)
             lowercase__      =					np.array([[0, 3], [3, 0], [2, 3]]					)
             lowercase__      =					np.array([[2, 1], [6, 3]]					)

             with self.assertRaises(UpperCamelCase					):
                    schur_complement(UpperCamelCase  ,		UpperCamelCase  ,		UpperCamelCase					)






      def  UpperCamelCase__						(self       :       Union[str, Any]					):

             '''simple docstring'''







             lowercase__      =					np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]					)
             lowercase__      =					np.array([[0, 3], [3, 0], [2, 3]]					)
             lowercase__      =					np.array([[2, 1, 3], [6, 3, 5]]					)

             with self.assertRaises(UpperCamelCase					):
                    schur_complement(UpperCamelCase  ,		UpperCamelCase  ,		UpperCamelCase					)


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 unittest.main()




