Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import gcd
- def coprime(a, b, c):
- return gcd(a, b) == 1 and gcd(a, c) == 1 and gcd(b, c) == 1
- sums, seen = [0]*1500001, []
- for x in range(1, int(1500000 ** 0.5 + 2)):
- for y in range(x + 1, 10 ** 10):
- if not coprime(x ** 2 + y ** 2, 2 * x * y, y ** 2 - x ** 2):
- continue
- total = 2 * y ** 2 + 2 * x * y
- for z in range(1, 10 ** 10):
- new_total = total * z
- if new_total > 1500000:
- break
- sums[new_total] += 1
- if total > 1500000:
- break
- print(sums.count(1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement