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.
#Ratio #dig_split def p33 frax=[] (11..99).each do |d| (10...d).each do |n| nn=dig_split(n) dd=dig_split(d) nn.each do |dig| next if dig==0 if(dd.include? dig) orig=Ratio.new(n,d) newer=Ratio.new(nn[(1+nn.index(dig))%2],dd[(1+dd.index(dig))%2]) frax.push orig if orig==newer end end end end puts frax.product.den end