

from __future__ import annotations

from collections import Counter
def 						UpperCamelCase_(			snake_case__:  int   )       -> list[int]:
 UpperCAmelCase__							=				[True] * n
 UpperCAmelCase__							=				False
 UpperCAmelCase__							=				False
 UpperCAmelCase__							=				True

 for i in range(3  ,    int(n**0.5 + 1   )  ,    2   ):
  UpperCAmelCase__							=				i * 2
  while index < n:
   UpperCAmelCase__							=				False
   UpperCAmelCase__							=				index + i

 UpperCAmelCase__							=				[2]

 for i in range(3  ,    snake_case__  ,    2   ):
  if is_prime[i]:
   primes.append(snake_case__   )

 return primes
def 						UpperCamelCase_(			snake_case__:  int   )       -> list[list[int]]:
 UpperCAmelCase__							=				str(snake_case__   )
 UpperCAmelCase__							=				[]
 UpperCAmelCase__							=				['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

 for duplicate in Counter(snake_case__   ) - Counter(set(snake_case__   )   ):
  UpperCAmelCase__							=				[int(number_str.replace(snake_case__  ,    snake_case__   )   ) for digit in digits]
  replacements.append(snake_case__   )

 return replacements
def 						UpperCamelCase_(			snake_case__:  int = 8   )       -> int:
 UpperCAmelCase__							=				set()

 # Filter primes with less than 3 replaceable digits
 UpperCAmelCase__							=				{
     x for x in set(prime_sieve(1_00_00_00   )   ) if len(str(snake_case__   )   ) - len(set(str(snake_case__   )   )   ) >= 3
 }

 for prime in primes:
  if prime in numbers_checked:
   continue

  UpperCAmelCase__							=				digit_replacements(snake_case__   )

  for family in replacements:
   numbers_checked.update(snake_case__   )
   UpperCAmelCase__							=				primes.intersection(snake_case__   )

   if len(snake_case__   ) != family_length:
    continue

   return min(snake_case__   )

 return -1


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









# as due to their complexity multi-gpu tests could impact other tests, and to aid debug we have those in a separate module.

import os
import sys

from transformers.testing_utils import TestCasePlus, execute_subprocess_async, get_gpu_count, require_torch_gpu, slow

from .utils import load_json


class 				__SCREAMING_SNAKE_CASE							(		lowerCamelCase  ):

					@classmethod
					def 	lowercase_							(				cls					):







						'''simple docstring'''




						return cls





					@slow
					@require_torch_gpu
					def 	lowercase_							(				self					):







						'''simple docstring'''




						lowerCamelCase_							:		Dict							   =							self.get_auto_remove_tmp_dir()
						lowerCamelCase_							:		Tuple							   =							f"\n            --model_name Helsinki-NLP/opus-mt-en-ro\n            --save_dir {output_dir}\n            --data_dir {self.test_file_dir_str}/test_data/wmt_en_ro\n            --num_beams 2\n            --task translation\n        ".split()

						# we want this test to run even if there is only one GPU, but if there are more we use them all
						lowerCamelCase_							:		List[Any]							   =							get_gpu_count()
						lowerCamelCase_							:		Union[str, Any]							   =							f"\n            -m torch.distributed.launch\n            --nproc_per_node={n_gpu}\n            {self.test_file_dir}/run_distributed_eval.py\n        ".split()
						lowerCamelCase_							:		int							   =							[sys.executable] + distributed_args + args
						execute_subprocess_async(__lowercase ,       env=self.get_env()					)

						lowerCamelCase_							:		Any							   =							os.path.join(__lowercase ,       'test_bleu.json'					)
						lowerCamelCase_							:		List[Any]							   =							load_json(__lowercase					)
						# print(metrics)
						self.assertGreaterEqual(metrics['bleu'] ,       25					)
