
"""simple docstring"""






from __future__ import annotations

from collections import Counter
def    UpperCamelCase						(					UpperCAmelCase     )						->list[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     )						->list[list[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 = 8     )						->int:

   """simple docstring"""



   a_						   =     set()

   # Filter primes with less than 3 replaceable digits
   a_						   =     {
       x for x in set(prime_sieve(1_000_000     )     ) 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"""






import math
def    UpperCamelCase						(					UpperCAmelCase     )						->bool:

   """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    UpperCamelCase						(					UpperCAmelCase = 600_851_475_143     )						->int:

   """simple docstring"""



   try:
      a_						   =     int(UpperCAmelCase     )
   except (TypeError, ValueError):
      raise TypeError("Parameter n must be int or castable to int."     )
   if n <= 0:
      raise ValueError("Parameter n must be greater than or equal to one."     )
   a_						   =     0
   if is_prime(UpperCAmelCase     ):
      return n
   while n % 2 == 0:
      n //= 2
   if is_prime(UpperCAmelCase     ):
      return n
   for i in range(3 ,   int(math.sqrt(UpperCAmelCase     )     ) + 1 ,   2     ):
      if n % i == 0:
         if is_prime(n // i     ):
            a_						   =     n // i
            break
         elif is_prime(UpperCAmelCase     ):
            a_						   =     i
   return max_number


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