Baekjoon Case

[파이썬 / 백준 6588번] 골드바흐의 추측

Scarlett_C 2021. 11. 21. 11:51
728x90

https://www.acmicpc.net/problem/6588

728x90
def aristo(a):
    if a==1:
        return False
    else:
        for i in range(2, int(a**0.5)+1):
            if a%i==0: 
                return False
        return True    

while True:
    n=int(input())
    if n==0: break
    for i in range(3,n+1,2):
        if aristo(i):
            if aristo(n-i):
                print(n,'=',i,'+',n-i)
                break
728x90