Skip to content
Browse files

problem 243.py

  • Loading branch information...
1 parent e6b9a47 commit 07415437ac0edbd2ee9695f5cbc731b6109193f3 @tingleshao committed Mar 30, 2013
Showing with 16 additions and 0 deletions.
  1. +16 −0 problem241to250/problem243.py
View
16 problem241to250/problem243.py
@@ -0,0 +1,16 @@
+# problem 243
+#http://blog.dreamshire.com/2012/12/19/project-euler-problem-243-solution/
+primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
+ratio = 15499/94744.0
+
+def denom(ratio):
+ d, s = 1, 1
+ for p in primes:
+ d *= p
+ s *= p-1
+ for i in range(2, p):
+ if s*i / (d*i-1.) < ratio:
+ return d*i
+ return "Please buy more primes!"
+
+print 'Answer to PE243 = ',denom(ratio)

0 comments on commit 0741543

Please sign in to comment.
Something went wrong with that request. Please try again.