


'''simple docstring'''



from __future__ import annotations

import numpy as np
from numpy import floataa
from numpy.typing import NDArray




def 			_a			(		_lowercase      :			int    ,      _lowercase      :			List[Any]    ,      _lowercase      :			Any    ,      _lowercase      :			Optional[int]    ,      ):





     '''simple docstring'''






     __UpperCAmelCase			:				List[str]													=    coefficient_matrix.shape
     __UpperCAmelCase			:				List[str]													=    constant_matrix.shape

     if rowsa != colsa:
          __UpperCAmelCase			:				Optional[int]													=    F'Coefficient matrix dimensions must be nxn but received {rowsa}x{colsa}'
          raise ValueError(__lowerCAmelCase						)

     if colsa != 1:
          __UpperCAmelCase			:				int													=    F'Constant matrix must be nx1 but received {rowsa}x{colsa}'
          raise ValueError(__lowerCAmelCase						)

     if rowsa != rowsa:
          __UpperCAmelCase			:				Any													=    (
              """Coefficient and constant matrices dimensions must be nxn and nx1 but """
              F'received {rowsa}x{colsa} and {rowsa}x{colsa}'
          )
          raise ValueError(__lowerCAmelCase						)

     if len(__lowerCAmelCase						) != rowsa:
          __UpperCAmelCase			:				Optional[int]													=    (
              """Number of initial values must be equal to number of rows in coefficient """
              F'matrix but received {len(__lowerCAmelCase						)} and {rowsa}'
          )
          raise ValueError(__lowerCAmelCase						)

     if iterations <= 0:
          raise ValueError('''Iterations must be at least 1'''						)

     __UpperCAmelCase			:				NDArray[floataa]													=    np.concatenate(
         (coefficient_matrix, constant_matrix)    ,      axis=1						)

     __UpperCAmelCase			:				Any													=    table.shape

     strictly_diagonally_dominant(__lowerCAmelCase						)

     # Iterates the whole matrix for given number of times
     for _ in range(__lowerCAmelCase						):
          __UpperCAmelCase			:				Union[str, Any]													=    []
          for row in range(__lowerCAmelCase						):
               __UpperCAmelCase			:				Optional[int]													=    0
               for col in range(__lowerCAmelCase						):
                    if col == row:
                         __UpperCAmelCase			:				Dict													=    table[row][col]
                    elif col == cols - 1:
                         __UpperCAmelCase			:				Optional[Any]													=    table[row][col]
                    else:
                         temp += (-1) * table[row][col] * init_val[col]
               __UpperCAmelCase			:				List[Any]													=    (temp + val) / denom
               new_val.append(__lowerCAmelCase						)
          __UpperCAmelCase			:				List[str]													=    new_val

     return [float(__lowerCAmelCase						) for i in new_val]




def 			_a			(		_lowercase      :			Tuple						):





     '''simple docstring'''






     __UpperCAmelCase			:				Union[str, Any]													=    table.shape

     __UpperCAmelCase			:				List[Any]													=    True

     for i in range(0    ,      __lowerCAmelCase						):
          __UpperCAmelCase			:				Dict													=    0
          for j in range(0    ,      cols - 1						):
               if i == j:
                    continue
               else:
                    total += table[i][j]

          if table[i][i] <= total:
               raise ValueError('''Coefficient matrix is not strictly diagonally dominant'''						)

     return is_diagonally_dominant


# Test Cases
if __name__ == "__main__":
      import doctest

      doctest.testmod()



'''simple docstring'''



def 			_a			(		_lowercase      :			int = 50000000						):





     '''simple docstring'''






     __UpperCAmelCase			:				List[str]													=    set()
     __UpperCAmelCase			:				Tuple													=    int((limit - 24) ** (1 / 2)						)

     __UpperCAmelCase			:				Tuple													=    set(range(3    ,      prime_square_limit + 1    ,      2						)						)
     primes.add(2						)
     for p in range(3    ,      prime_square_limit + 1    ,      2						):
          if p not in primes:
               continue
          primes.difference_update(set(range(p * p    ,      prime_square_limit + 1    ,      _lowercase						)						)						)

     for primea in primes:
          __UpperCAmelCase			:				Any													=    primea * primea
          for primea in primes:
               __UpperCAmelCase			:				Any													=    primea * primea * primea
               if square + cube >= limit - 16:
                    break
               for primea in primes:
                    __UpperCAmelCase			:				Optional[Any]													=    primea * primea * primea * primea
                    __UpperCAmelCase			:				Union[str, Any]													=    square + cube + tetr
                    if total >= limit:
                         break
                    ret.add(_lowercase						)

     return len(_lowercase						)


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