题解 | #查找组成一个偶数最接近的两个素数#
# 判断一个数是素数
def is_ss(n):
flag = True
for i in range(2, n):
if n % i == 0:
flag = False
break
return flag
while True:
try:
num = int(input())
arr = [] # 存储满足条件的其中一个素数
arr_min = [] # 存储满足条件的所有素数的差值
for i in range(1, num//2 + 1):
for j in range(num//2, num):
if is_ss(i) and is_ss(j) and i + j == num:
arr.append(i)
arr_min.append(abs(i - j))
index = arr_min.index(min(arr_min))
x = arr[index]
y = num - x
re = sorted([x, y])
for i in re:
print(i)
except:
break