A Pythagorean triple is a set of three positive integers a,b,c such that c2=a2+b2. Among those triples, there is a single one such that a+b+c=1000
def findTheTriple(n=1000):
return next({a, b, n - a - b}
for a in range(1, n // 2)
for b, m in [divmod(n * (n - 2 * a), 2 * (n - a))]
if not m)