题解 | #查找组成一个偶数最接近的两个素数#
查找组成一个偶数最接近的两个素数
https://www.nowcoder.com/practice/f8538f9ae3f1484fb137789dec6eedb9
def isprime(x): if x < 2: return False for i in range(2,int(x/2)+1): if x%i == 0: return False else: pass return True n = int(input()) MIN = n for i in range(2,n+1): if isprime(i) and isprime(n-i): if abs(n-i-i) < MIN: MIN = abs(n-i-i) a = i b = n-i print(a) print(b)