n = int(input()) # Overall logic (Read before proceeding to the solution): # 1. Perform a floor division by 2 on the input (even) number denoted as n. # 2. Gradually reduce the resultant number from step 1 by 1 and # check if the number is a prime number. Denote this number # as b. # 2.1 If b is a prime number, then calculate c as: c = n - b # 2.2 If c is is NOT a prime number, reduce b by 1 until it is a prime # number again. # 3. This process terminates once both b and c are prime numbers. In other # words, suppose we write a while loop, then if EITHER b OR c is NOT a # a prime number, the while loop should keep going. # Solution: # First, you need write a function that checks whether an input integer # is a prime number: def is_prime(n): if n < 2: return False for i in range(2, int(n**0.5)+1): """ Why do we take the square root of n here? Because if a factor that is larger than sqrt(n) exists (t), then there MUST BE another factor that is SMALLER than sqrt(n) exists (s) such that s*t = n. Therefore, there is NO NEED to check beyond int(n**0.5)+1 """ if n%i == 0: # If any of the factors from i up to round(sqrt(n))+1 # can a factor of n, then n is NOT a prime number. return False return True b = n // 2 # Start the value of b from the result of the floor division # of n by 2. c = n - b while not (is_prime(b) and is_prime(c)): b -= 1 c = n - b print(b) print(c)