code: 
  
  
  from __future__ import annotations
  
  from collections import Counter
  
  
  
  
  def 			__lowercase	(						_UpperCamelCase     )    ->list[int]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Optional[int]					   =		[True] * n
        lowercase			:   Optional[Any]					   =		False
        lowercase			:   Optional[int]					   =		False
        lowercase			:   Any					   =		True
  
        for i in range(3,    int(n**0.5 + 1     ),    2     ):
              lowercase			:   Union[str, Any]					   =		i * 2
              while index < n:
                    lowercase			:   List[str]					   =		False
                    lowercase			:   Tuple					   =		index + i
  
        lowercase			:   Any					   =		[2]
  
        for i in range(3,    _UpperCamelCase,    2     ):
              if is_prime[i]:
                    primes.append(_UpperCamelCase     )
  
        return primes
  
  
  
  
  def 			__lowercase	(						_UpperCamelCase     )    ->list[list[int]]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   List[Any]					   =		str(_UpperCamelCase     )
        lowercase			:   str					   =		[]
        lowercase			:   Union[str, Any]					   =		['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']
  
        for duplicate in Counter(_UpperCamelCase     ) - Counter(set(_UpperCamelCase     )     ):
              lowercase			:   Dict					   =		[int(number_str.replace(_UpperCamelCase,    _UpperCamelCase     )     ) for digit in digits]
              replacements.append(_UpperCamelCase     )
  
        return replacements
  
  
  
  
  def 			__lowercase	(						_UpperCamelCase = 8     )    ->int:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Optional[int]					   =		set()
  
        # Filter primes with less than 3 replaceable digits
        lowercase			:   Any					   =		{
            x for x in set(prime_sieve(1000000     )     ) if len(str(_UpperCamelCase     )     ) - len(set(str(_UpperCamelCase     )     )     ) >= 3
        }
  
        for prime in primes:
              if prime in numbers_checked:
                    continue
  
              lowercase			:   Optional[Any]					   =		digit_replacements(_UpperCamelCase     )
  
              for family in replacements:
                    numbers_checked.update(_UpperCamelCase     )
                    lowercase			:   Optional[int]					   =		primes.intersection(_UpperCamelCase     )
  
                    if len(_UpperCamelCase     ) != family_length:
                          continue
  
                    return min(_UpperCamelCase     )
  
        return -1
  
  
  if __name__ == "__main__":
    print(solution())
  
  
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
  
  
  __a   				=      {'''configuration_yoso''': ['''YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''YosoConfig''']}
  
  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    __a   				=      [
        '''YOSO_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''YosoForMaskedLM''',
        '''YosoForMultipleChoice''',
        '''YosoForQuestionAnswering''',
        '''YosoForSequenceClassification''',
        '''YosoForTokenClassification''',
        '''YosoLayer''',
        '''YosoModel''',
        '''YosoPreTrainedModel''',
    ]
  
  
  if TYPE_CHECKING:
    from .configuration_yoso import YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP, YosoConfig
  
    try:
      if not is_torch_available():
        raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
      pass
    else:
      from .modeling_yoso import (
          YOSO_PRETRAINED_MODEL_ARCHIVE_LIST,
          YosoForMaskedLM,
          YosoForMultipleChoice,
          YosoForQuestionAnswering,
          YosoForSequenceClassification,
          YosoForTokenClassification,
          YosoLayer,
          YosoModel,
          YosoPreTrainedModel,
      )
  
  
  else:
    import sys
  
    __a   				=      _LazyModule(__name__, globals()['''__file__'''], _import_structure)
  
  