loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.12321347389597403","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZGVmIGRpdmlzb3JzKG4pOgogICAgZm9yIGRpdmlzb3IgaW4gcmFuZ2UoMSwgaW50KG4qKjAuNSkgKyAxKToKICAgICAgICBpZiBuICUgZGl2aXNvciA9PSAwOgogICAgICAgICAgICB5aWVsZCBkaXZpc29yLCBuLy9kaXZpc29yCnBuID0gZGljdCgpCmZvciByIGluIHJhbmdlKDIsIDU1MCwgMik6CiAgICBzdCA9IHIqciAvLyAyCiAgICBmb3IgcywgdCBpbiBkaXZpc29ycyhzdCk6CiAgICAgICAgeCA9IChyK3MpICsgKHIrdCkgKyAocitzK3QpCiAgICAgICAgcG5beF0gPSAocitzKSAqIChyK3QpICogKHIrcyt0KQoKcCA9IGludChpbnB1dCgnUHl0aGFnb3JlYW4gdGFyZ2V0IHN1bSAoZXZlbiBudW1iZXIpPycpKQpwcmludCAiUmVzdWx0OiIsIHBuW3BdIGlmIHAgaW4gcG4gZWxzZSAiSW1wb3NzaWJsZSBzdW0uIg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
def divisors(n):
    for divisor in range(1, int(n**0.5) + 1):
        if n % divisor == 0:
            yield divisor, n//divisor
pn = dict()
for r in range(2, 550, 2):
    st = r*r // 2
    for s, t in divisors(st):
        x = (r+s) + (r+t) + (r+s+t)
        pn[x] = (r+s) * (r+t) * (r+s+t)

p = int(input('Pythagorean target sum (even number)?'))
print "Result:", pn[p] if p in pn else "Impossible sum."