''' If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. {20,48,52}, {24,45,51}, {30,40,50} For which value of p ≤ 1000, is the number of solutions maximised? ''' import math def main(): print("Hello this is Patrick") ps = [0]*1000 for a in range(1, 1000): for b in range(1, 1000-a): c2 = a**2 + b**2 r = math.sqrt(c2) if c2 == int(r + 0.5) ** 2: r = int(r + 0.5) if a + b + r <= 1000: ps[a + b + r - 1] += 1 print(ps.index(max(ps)) + 1) if __name__ == "__main__": main()