def pythagorean_triples(n): """Finds a, b, and c such that a + b + c = n and a^2 + b^2 = c^2. Arguments: n: Value from which to determine pythagorean triples. Returns: Resulting combination of a, b, and c to satisfy the formula. """ a, b = 1, 1 while (a < n // 2): while (b < n // 2): c = n - a - b if (a**2 + b**2 == c**2): return a, b, c b = b + 1 a, b = a + 1, 1