From 95341b61b030c9e1290f3b326cb7ec584f543aea Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 31 Aug 2014 20:21:45 +0200 Subject: moved files to higher directory after split to new repository --- 039.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 039.py (limited to '039.py') 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 + -- cgit v1.2.3