Try
def solution(): for i in range(1000): for j in range(1000): for k in range(1000): if i == 0 or j == 0 or k == 0: continue if i + j + k == 1000: if i*i + j*j == k*k: print(i * j * k) return solution() 출처 http://euler.synap.co.kr/prob_detail.php?id=9
res = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720..
CHECK = [False, False] + [True] * 1000000 Primes = [] for i in range(2, 1000000): if CHECK[i]: Primes.append(i) for j in range(2 * i, 1000000, i): CHECK[j] = False print(Primes[10000]) 출처 http://euler.synap.co.kr/prob_detail.php?id=7
A = 0 B = 0 for i in range(1, 101): A += i * i B += i print((B * B) - A) 출처 http://euler.synap.co.kr/prob_detail.php?id=6
def gcd(a, b): while b is not 0: d = a % b a = b b = d return a def lcm(a, b): return a * b // gcd(a, b) ans = 0 SUM = 1 for i in range(1, 20): ans = lcm(i, SUM) SUM = ans print(ans) 출처 http://euler.synap.co.kr/submit_answer.php