28 lines
628 B
Python
28 lines
628 B
Python
|
|
from pprint import pprint
|
|
|
|
MAX_NUM = 1000
|
|
|
|
if __name__ == '__main__':
|
|
As = list(range(1, MAX_NUM))
|
|
results = []
|
|
totals = {}
|
|
|
|
for a in As:
|
|
for b in range(a, MAX_NUM):
|
|
if a > b:
|
|
continue
|
|
c = (a**2 + b**2) ** 0.5
|
|
if c % 1 != 0:
|
|
continue
|
|
total = a + b + int(c)
|
|
if total > MAX_NUM:
|
|
continue
|
|
results.append((a, b, int(c), total))
|
|
if total in totals:
|
|
totals[total] += 1
|
|
else:
|
|
totals[total] = 1
|
|
|
|
print(max(totals, key=totals.get))
|