



from __future__ import annotations

from collections import Counter


def 						UpperCAmelCase__   (   UpperCAmelCase__			:int       ):






 '''simple docstring'''

 a							=		[True] * n
 a							=		False
 a							=		False
 a							=		True

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

 a							=		[2]

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

 return primes


def 						UpperCAmelCase__   (   UpperCAmelCase__			:int       ):






 '''simple docstring'''

 a							=		str(UpperCAmelCase__       )
 a							=		[]
 a							=		["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

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

 return replacements


def 						UpperCAmelCase__   (   UpperCAmelCase__			:int = 8       ):






 '''simple docstring'''

 a							=		set()

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

 for prime in primes:
  if prime in numbers_checked:
   continue

  a							=		digit_replacements(UpperCAmelCase__       )

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

   if len(UpperCAmelCase__       ) != family_length:
    continue

   return min(UpperCAmelCase__       )

 return -1


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







'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


lowercase						:   int      						=							{
    '''configuration_xlm_prophetnet''': ['''XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMProphetNetConfig'''],
}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   Any      						=							['''XLMProphetNetTokenizer''']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   Tuple      						=							[
          '''XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''XLMProphetNetDecoder''',
          '''XLMProphetNetEncoder''',
          '''XLMProphetNetForCausalLM''',
          '''XLMProphetNetForConditionalGeneration''',
          '''XLMProphetNetModel''',
          '''XLMProphetNetPreTrainedModel''',
      ]


if TYPE_CHECKING:
      from .configuration_xlm_prophetnet import XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMProphetNetConfig

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_xlm_prophetnet import XLMProphetNetTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_xlm_prophetnet import (
                XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
                XLMProphetNetDecoder,
                XLMProphetNetEncoder,
                XLMProphetNetForCausalLM,
                XLMProphetNetForConditionalGeneration,
                XLMProphetNetModel,
                XLMProphetNetPreTrainedModel,
            )

else:
      import sys

      lowercase						:   Optional[Any]      						=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




