先定义一个判断是否为质数的函数,函数只需检索待检测数一半以下的所有数。再用循环从待检测数的中间开始向两边检索,指导发现一组质数。

def iszhishu(x):
    if x<4:
        return True
    else:
        for i in range(2,int(x/2)+1):
            if x%i==0:
                return False
    return True

while True:
    try:
        n=int(input())
        h=int(n/2)-int((n/2)%2==0)
        while not (iszhishu(h) and iszhishu(n-h)):
            h=h-2
        print(h)
        print(n-h)
    except:
        break