






"""simple docstring"""




import math
from itertools import permutations

def     lowerCAmelCase__  (  UpperCamelCase__       ):



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

def     lowerCAmelCase__  (  UpperCamelCase__  ,     UpperCamelCase__       ):



  '''simple docstring'''
  _a   ,						_a						: List[str]    =			0, len(UpperCamelCase__       ) - 1
  while left <= right:
    _a						: Tuple    =			(left + right) // 2
    if prime_list[middle] == target:
      return True
    elif prime_list[middle] < target:
      _a						: Union[str, Any]    =			middle + 1
    else:
      _a						: str    =			middle - 1

  return False

def     lowerCAmelCase__  (  ):



  '''simple docstring'''
  _a						: Union[str, Any]    =			[n for n in range(1_0_0_1  ,     1_0_0_0_0  ,     2       ) if is_prime(UpperCamelCase__       )]
  _a						: List[str]    =			[]

  for number in prime_list:
    _a						: str    =			[]

    for prime_member in permutations(list(str(UpperCamelCase__       )       )       ):
      _a						: 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__       )

  _a						: int    =			[]
  for candidate in candidates:
    _a						: Union[str, Any]    =			len(UpperCamelCase__       )
    _a						: 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]]       )       )
            _a						: Dict    =			True

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

  _a						: Tuple    =			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())









"""simple docstring"""




import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


_snake_case					   =     1000_0000_0000
_snake_case					   =     1_0000

_snake_case   ,				_snake_case					   =     os.path.split(__file__)
_snake_case					   =     os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENAME.replace('.py', '.json'))

def     lowerCAmelCase__  (  UpperCamelCase__  ,     UpperCamelCase__       ):



  '''simple docstring'''
  _a						: Union[str, Any]    =			pa.Table.from_pydict({"""col""": [0] * chunk_size}       )
  _a						: Dict    =			pa.concat_tables([table] * (num_examples // chunk_size)       )
  return datasets.Dataset(UpperCamelCase__  ,     fingerprint="""table_100B"""       )






@dataclass
class  UpperCamelCase    :
 UpperCamelCase      : int
 UpperCamelCase      : int
 UpperCamelCase      : int
 UpperCamelCase      : int


 def _lowercase			(  self	:		Optional[int]							)      -> Dict:
   _a						: Tuple    =			np.random.default_rng(self.seed							)
   _a						: Dict    =			rng.integers(low=self.low							,		high=self.high							,		size=self.size							).tolist()


 def __iter__(  self	:		List[Any]							)      -> Optional[Any]:
   return iter(self._sampled_values							)







 def __len__(  self	:		Dict							)      -> Optional[Any]:
   return self.size







@get_duration
def     lowerCAmelCase__  (  UpperCamelCase__       ):



  '''simple docstring'''
  _a						: Union[str, Any]    =			dataset[0]

@get_duration
def     lowerCAmelCase__  (  UpperCamelCase__       ):



  '''simple docstring'''
  _a						: Optional[Any]    =			dataset[-1]

@get_duration
def     lowerCAmelCase__  (  UpperCamelCase__       ):



  '''simple docstring'''
  _a						: str    =			dataset[range(len(UpperCamelCase__       ) // 2  ,     len(UpperCamelCase__       ) // 2 + 1_0_2_4       )]

@get_duration
def     lowerCAmelCase__  (  UpperCamelCase__       ):



  '''simple docstring'''
  _a						: Tuple    =			dataset[RandIter(0  ,     len(UpperCamelCase__       )  ,     1_0_2_4  ,     seed=4_2       )]

def     lowerCAmelCase__  (  ):



  '''simple docstring'''
  _a						: str    =			{"""num examples""": SPEED_TEST_N_EXAMPLES}
  _a						: Dict    =			(get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
  print("""generating dataset"""       )
  _a						: List[str]    =			generate_100B_dataset(num_examples=UpperCamelCase__  ,     chunk_size=UpperCamelCase__       )
  print("""Functions"""       )
  for func in functions:
    print(func.__name__       )
    _a						: Optional[Any]    =			func(UpperCamelCase__       )

  with open(UpperCamelCase__  ,     """wb"""       ) as f:
    f.write(json.dumps(UpperCamelCase__       ).encode("""utf-8"""       )       )


if __name__ == "__main__":  # useful to run the profiler
 benchmark_table_100B()

