Finished 9, easy brute force solution

This commit is contained in:
2020-03-31 00:46:27 +02:00
parent 5e7d81e847
commit 03bb8d283f

28
9/main.py Normal file
View File

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