Initial commit

This commit is contained in:
Kevin Keogh
2018-07-02 15:45:49 -04:00
parent 60b3954a3b
commit fd817f8811
28 changed files with 809 additions and 0 deletions

27
problem-39.py Normal file
View File

@@ -0,0 +1,27 @@
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))