//
// Euler problem 33
// """
// 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.
// """
//
// This SETL program was created by Hakan Kjellerstrand (hakank@bonetmail.com).
// See also my SETL page: http://www.hakank.org/setl/
problem33 := procedure() {
s := 1;
for (y in [1..9]) {
for (z in [y..9]) {
x := 9.0*y*z/(10*y-z);
if (floor(x)==x && 1.0*y/z < 1 && x < 10) {
s := (s*y)/z;
print(x," ", y, " ", z, " ", (floor(10*y+x)),"/", (floor(z+10*x)), " ", y,"/",z, " ", 1/s);
}
}
}
print(1/s);
};
problem33();