The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s.

We shall consider fractions like, 30/50 = 3/5, to be trivial examples.

There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.

If the product of these four fractions is given in its lowest common terms, find the value of the denominator.


In [1]:
for i in range(11,100):
    d = [int(d) for d in str(i)]
    if d[1] == 0 or d[0] == d[1]:
        continue
    
    od = [c for c in range(1,10)]
    for o in od:
        if d[0] > o:
            continue
            
        # a/b = c/d -> a*d = c*b
        if i*o == d[0]*(d[1]*10 + o):
            print i,'/',"%i%i"%(d[1],o),'=',d[0],'/',o


16 / 64 = 1 / 4
19 / 95 = 1 / 5
26 / 65 = 2 / 5
49 / 98 = 4 / 8

So (1/4)(1/5)(2/5)(1/2) = (1/4)(1/5)*(1/5)

i.e. 4 x 5 x 5 = 100.


In [ ]: