summaryrefslogtreecommitdiff
path: root/071.py
blob: 44c38b0107313c50b885b20cf9542e2d8ee1acc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

from common import ggt
import math

limit = 1000000

(n1, d1) = (1, limit)

for d2 in xrange(limit+1):
    n2 = int(math.floor(float(d2) * 3.0/7.0))
    if n2*d1 > n1*d2 and ggt(n2, d2) == 1 and d2 != 7:
	(n1, d1) = (n2, d2)

print n1