




'''simple docstring'''







import math
from itertools import permutations






def 		_lowercase		(	lowercase_  ):



		'''simple docstring'''







		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(lowercase_  ) + 1  )						,							6  ):
				if number % i == 0 or number % (i + 2) == 0:
						return False
		return True






def 		_lowercase		(	lowercase_						,							lowercase_  ):



		'''simple docstring'''







		_snake_case       ,    _snake_case	       =       0, len(lowercase_  ) - 1
		while left <= right:
				_snake_case	       =       (left + right) // 2
				if prime_list[middle] == target:
						return True
				elif prime_list[middle] < target:
						_snake_case	       =       middle + 1
				else:
						_snake_case	       =       middle - 1

		return False






def 		_lowercase		(	):



		'''simple docstring'''







		_snake_case	       =       [n for n in range(1001						,							10000						,							2  ) if is_prime(lowercase_  )]
		_snake_case	       =       []

		for number in prime_list:
				_snake_case	       =       []

				for prime_member in permutations(list(str(lowercase_  )  )  ):
						_snake_case	       =       int("".join(lowercase_  )  )

						if prime % 2 == 0:
								continue

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

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

		_snake_case	       =       []
		for candidate in candidates:
				_snake_case	       =       len(lowercase_  )
				_snake_case	       =       False

				for i in range(lowercase_  ):
						for j in range(i + 1						,							lowercase_  ):
								for k in range(j + 1						,							lowercase_  ):
										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]]  )  )
												_snake_case	       =       True

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

		_snake_case	       =       set()
		for seq in passed:
				answer.add("".join([str(lowercase_  ) for i in seq]  )  )

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


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












def    _lowercase    (  _UpperCAmelCase = 99_80_01 )  ->     int:

				# fetches the next number
				for number in range(n - 1	,					99_99	,					-1 ):
								lowerCamelCase		       =str(_UpperCAmelCase )

								# checks whether 'str_number' is a palindrome.
								if str_number == str_number[::-1]:
												lowerCamelCase		       =9_99

												# if 'number' is a product of two 3-digit numbers
												# then number is the answer otherwise fetch next number.
												while divisor != 99:
																if (number % divisor == 0) and (len(str(number // divisor ) ) == 3.0):
																				return number
																divisor -= 1
				raise ValueError("""That number is larger than our acceptable range.""" )


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





