Skip to content

Commit 34d567a

Browse files
committed
12.17 jhuni17 2주차 풀이: 골든바흐의 추측 (시간초과)
1 parent 382283f commit 34d567a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

week2/6588_jhuni17.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#6588 골드바흐의 추측
2+
3+
def is_odd_prime(n):
4+
for i in range(3, int(n**0.5)+1, 2):
5+
if n % i ==0:
6+
return 0
7+
return 1
8+
9+
def solution(N):
10+
for i in range(3, int(N/2)+1, 2):
11+
if is_odd_prime(i) == 1 and is_odd_prime(N-i):
12+
return print(f"{N} = {i} + {N-i}")
13+
14+
print("Goldbach's conjecture is wrong.")
15+
16+
while True:
17+
N = int(input())
18+
if N == 0:
19+
break
20+
solution(N)

0 commit comments

Comments
 (0)