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

We shall consider fractions like, $\frac{30}{50} = \frac{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.

  1. Let's find the valid examples via brute force, given the form $\frac{ab}{cd}$.

In [16]:
values = []
for a = 1:9
    for b = 0:9
        for c = 1:9
            for d = 0:9
                n = a * 10 + b
                de = c * 10 + d
                if n < de 
                    v = n / de
                    if (b != 0 && b == d && v == a / c) || 
                       (b != 0 && b == c && v == a / d) || 
                       (a != 0 && a == d && v == b / c) || 
                       (a != 0 && a == c && v == b / d)
                        push!(values, (n, de))
                    end
                end
            end
        end
    end
end
print(values)


Any[(16,64),(19,95),(26,65),(49,98)]

In [33]:
n = prod([i[1] for i in values])
de = prod([i[2] for i in values])
println(n, "/", de, " -> ", n//de)
den(n//de)


387296/38729600 -> 1//100
Out[33]:
100

In [ ]: