28 lines
425 B
Python
28 lines
425 B
Python
import os
|
|
import numpy as np
|
|
|
|
|
|
|
|
# Find the pythagorean triplet that sums to 1000
|
|
|
|
|
|
|
|
|
|
def checkPythTriplet(a, b, c):
|
|
return pow(a, 2) + pow(b, 2) == pow(c, 2)
|
|
|
|
|
|
def main():
|
|
print("Hello, this is Patrick")
|
|
|
|
|
|
for b in range(500):
|
|
for a in range(b):
|
|
c = 1000 - b - a
|
|
|
|
if b < c and checkPythTriplet(a, b, c):
|
|
print(a, b, c, a*b*c)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |