Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Solving 85, woot

  • Loading branch information...
commit 791ad71a863886ae066f05cb0e7024f37ab129b7 1 parent 9df60a7
@coleifer authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 problem85.py
View
22 problem85.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+def ct(m, n):
+ return ((n*n + n) * (m*m + m)) / 4
+
+diff = 1000000
+bits = None
+
+# don't know how to calculate the minimum of
+# (n^2 + n)(m^2 + m) - 4000000 = 0
+
+# know that 1, 2000 = 2001000, so we can assume
+# upper bound is 2000
+
+for i in range(2, 2000):
+ for j in range(i, 2000):
+ x = ct(i, j)
+ new_diff = abs(2000000 - x)
+ if new_diff < diff:
+ diff = new_diff
+ bits = x, i, j, i*j
+print '%s...%s * %s = %s' % bits
Please sign in to comment.
Something went wrong with that request. Please try again.