


'''simple docstring'''



import cva
import numpy as np



def       UpperCAmelCase__ (     UpperCAmelCase_   :    np.ndarray				,   UpperCAmelCase_   :    int				,   UpperCAmelCase_   :    int				,   UpperCAmelCase_   :    int							)					->		int:

     try:
          return int(image[x_coordinate][y_coordinate] >= center							)
     except (IndexError, TypeError):
          return 0



def       UpperCAmelCase__ (     UpperCAmelCase_   :    np.ndarray				,   UpperCAmelCase_   :    int				,   UpperCAmelCase_   :    int							)					->		int:
     __lowerCamelCase       :     List[Any]        =		image[x_coordinate][y_coordinate]
     __lowerCamelCase       :     List[Any]        =		[1, 2, 4, 8, 16, 32, 64, 1_28]

     # skip get_neighbors_pixel if center is null
     if center is None:
          return 0

     # Starting from the top right, assigning value to pixels clockwise
     __lowerCamelCase       :     Union[str, Any]        =		[
         get_neighbors_pixel(UpperCAmelCase_				,   x_coordinate - 1				,   y_coordinate + 1				,   UpperCAmelCase_							),
         get_neighbors_pixel(UpperCAmelCase_				,   UpperCAmelCase_				,   y_coordinate + 1				,   UpperCAmelCase_							),
         get_neighbors_pixel(UpperCAmelCase_				,   x_coordinate - 1				,   UpperCAmelCase_				,   UpperCAmelCase_							),
         get_neighbors_pixel(UpperCAmelCase_				,   x_coordinate + 1				,   y_coordinate + 1				,   UpperCAmelCase_							),
         get_neighbors_pixel(UpperCAmelCase_				,   x_coordinate + 1				,   UpperCAmelCase_				,   UpperCAmelCase_							),
         get_neighbors_pixel(UpperCAmelCase_				,   x_coordinate + 1				,   y_coordinate - 1				,   UpperCAmelCase_							),
         get_neighbors_pixel(UpperCAmelCase_				,   UpperCAmelCase_				,   y_coordinate - 1				,   UpperCAmelCase_							),
         get_neighbors_pixel(UpperCAmelCase_				,   x_coordinate - 1				,   y_coordinate - 1				,   UpperCAmelCase_							),
     ]

     # Converting the binary value to decimal.
     return sum(
         binary_value * power for binary_value, power in zip(UpperCAmelCase_				,   UpperCAmelCase_							)							)


if __name__ == "__main__":
       # Reading the image and converting it to grayscale.
       A__		: List[Any]												=  cva.imread(
           """digital_image_processing/image_data/lena.jpg""", cva.IMREAD_GRAYSCALE
       )

       # Create a numpy array as the same height and width of read image
       A__		: List[str]												=  np.zeros((image.shape[0], image.shape[1]))

       # Iterating through the image and calculating the
       # local binary pattern value for each pixel.
       for i in range(0, image.shape[0]):
              for j in range(0, image.shape[1]):
                     A__		: List[str]												=  local_binary_value(image, i, j)

       cva.imshow("""local binary pattern""", lbp_image)
       cva.waitKey(0)
       cva.destroyAllWindows()










'''simple docstring'''



import math
from itertools import permutations



def       UpperCAmelCase__ (     UpperCAmelCase_   :    int							)					->		bool:

     if 1 < number < 4:
          # 2 and 3 are primes
          return True
     elif number < 2 or number % 2 == 0 or number % 3 == 0:
          # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
          return False

     # All primes number are in format of 6k +/- 1
     for i in range(5				,   int(math.sqrt(UpperCAmelCase_							) + 1							)				,   6							):
          if number % i == 0 or number % (i + 2) == 0:
               return False
     return True



def       UpperCAmelCase__ (     UpperCAmelCase_   :    int				,   UpperCAmelCase_   :    list							)					->		bool:
     __lowerCamelCase    ,	__lowerCamelCase       :     str        =		0, len(UpperCAmelCase_							) - 1
     while left <= right:
          __lowerCamelCase       :     Optional[Any]        =		(left + right) // 2
          if prime_list[middle] == target:
               return True
          elif prime_list[middle] < target:
               __lowerCamelCase       :     Union[str, Any]        =		middle + 1
          else:
               __lowerCamelCase       :     Union[str, Any]        =		middle - 1

     return False



def       UpperCAmelCase__ (     )					->		List[str]:
     __lowerCamelCase       :     Tuple        =		[n for n in range(10_01				,   1_00_00				,   2							) if is_prime(UpperCAmelCase_							)]
     __lowerCamelCase       :     Any        =		[]

     for number in prime_list:
          __lowerCamelCase       :     Optional[int]        =		[]

          for prime_member in permutations(list(str(UpperCAmelCase_							)							)							):
               __lowerCamelCase       :     int        =		int(''.join(UpperCAmelCase_							)							)

               if prime % 2 == 0:
                    continue

               if search(UpperCAmelCase_				,   UpperCAmelCase_							):
                    tmp_numbers.append(UpperCAmelCase_							)

          tmp_numbers.sort()
          if len(UpperCAmelCase_							) >= 3:
               candidates.append(UpperCAmelCase_							)

     __lowerCamelCase       :     int        =		[]
     for candidate in candidates:
          __lowerCamelCase       :     Union[str, Any]        =		len(UpperCAmelCase_							)
          __lowerCamelCase       :     Optional[Any]        =		False

          for i in range(UpperCAmelCase_							):
               for j in range(i + 1				,   UpperCAmelCase_							):
                    for k in range(j + 1				,   UpperCAmelCase_							):
                         if (
                             abs(candidate[i] - candidate[j]							)
                             == abs(candidate[j] - candidate[k]							)
                             and len({candidate[i], candidate[j], candidate[k]}							) == 3
                         ):
                              passed.append(
                                  sorted([candidate[i], candidate[j], candidate[k]]							)							)
                              __lowerCamelCase       :     List[str]        =		True

                         if found:
                              break
                    if found:
                         break
               if found:
                    break

     __lowerCamelCase       :     List[Any]        =		set()
     for seq in passed:
          answer.add(''.join([str(UpperCAmelCase_							) for i in seq]							)							)

     return max(int(UpperCAmelCase_							) for x in answer							)


if __name__ == "__main__":
      print(solution())






