diff options
Diffstat (limited to 'Problem39.py')
-rw-r--r-- | Problem39.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Problem39.py b/Problem39.py new file mode 100644 index 0000000..8666f1b --- /dev/null +++ b/Problem39.py @@ -0,0 +1,21 @@ +#Completed 9/13/2021 13:16 +import math +def rightTriangleSides(n): + a,b,c = 0,0,0 + count = 0 + for a in range(0,int(n/3)): + for b in range(a,int(n/2)): + c = math.sqrt((a*a)+(b*b)) + if (a+b+c)==n: + count+=1 + return count +max = 0 +value = 0 +for x in range(0,1000): + if rightTriangleSides(x) > max: + max = rightTriangleSides(x) + value = x + print(max) +print("The value for which the number of solutions is maximised is:", value) + + |