きったんの頭

#! /usr/bin/env python3
"""
pe9.py
https://mind.kittttttan.info/py/pe9
"""

def pe9(limit=1000):
    """
    Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000.
    """
    l2 = (limit >> 1) + 1
    # list = []
    for x in range(1, l2):
        for y in range(x, l2):
            z = limit - x - y
            if x * x + y * y == z * z:
                print(x * y * z)
                # list.append((x, y, z))
                return
    # return list

if __name__ == "__main__":
    pe9()