summaryrefslogtreecommitdiff
path: root/039.py
diff options
context:
space:
mode:
Diffstat (limited to '039.py')
-rw-r--r--039.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/039.py b/039.py
new file mode 100644
index 0000000..6a6bd0b
--- /dev/null
+++ b/039.py
@@ -0,0 +1,21 @@
+
+def solutions(p):
+ solution = 0
+ for a in xrange(1, p/2):
+ for b in xrange(a, p-a):
+ c = p - a - b
+ if a*a + b*b == c*c:
+ solution += 1
+ return solution
+
+max_solutions = 0
+max_p = 0
+
+for p in xrange(3, 1000):
+ n = solutions(p)
+ if n > max_solutions:
+ max_solutions = n
+ max_p = p
+
+print max_p
+