From 1161f9a034de06a63538e3a9a0b7717098c744d9 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Fri, 7 Apr 2023 08:13:49 -0500 Subject: Initial Commit --- Problem39.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Problem39.py (limited to 'Problem39.py') 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) + + -- cgit v1.2.3