Initial commit
This commit is contained in:
27
problem-39.py
Normal file
27
problem-39.py
Normal 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))
|
||||
Reference in New Issue
Block a user