Project Euler with Befunge
Problem 033: Digit canceling fractions
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.
vp09p08 < >80g55+/90g55+/-#v_v
v < < <
@v\p05:< v < < <
.>50g%:|: < >80g55+%90g55+/-#v_v
^/\g02$< g>80g55+%| >80g90g55+%*90g80g55+/*-#v_v
0v < < <
0v < < <
^ p0 9"c"<
^ ># ^#<
This one was relaxing. You can simple iterate through all 8100 cases and test each one in short time.
Three notable things:
|Interpreter steps:||661 502|
|Execution time (BefunExec):||109ms (6.07 MHz)|
|Program size:||67 x 18 (fully conform befunge-93)|