Find the positive integer pair (m, n) such that m*n is the minimum and the last 98 digits in mm*nn are all zeroes.
Note: 99th digit from the right in mm*nn is not zero.
The lowest I get is 75*98=7350.
CLS
FOR b = 0 TO 13
FOR y = 0 TO 13
FOR c = 0 TO 5
FOR z = 0 TO 5
m0 = INT(2 ^ b * 5 ^ c + .5)
n0 = INT(2 ^ y * 5 ^ z + .5)
IF m0 < 20000 AND n0 < 20000 THEN
a = 1
DO
IF a MOD 5 > 0 THEN
x = 1
DO
IF x MOD 5 > 0 THEN
m = a * m0
n = x * n0
p2 = b * m + y * n
p5 = c * m + z * n
IF p2 = 98 AND p5 >= 98 OR p5 = 98 AND p2 >= 98 THEN
IF m * n < 10300 THEN
PRINT m, n, m * n
END IF
END IF
END IF
x = x + 2
LOOP UNTIL x * n0 > 20000 OR x > 100
END IF
a = a + 2
LOOP UNTIL a * m0 > 20000 OR a > 250
END IF
NEXT z
NEXT c
NEXT y
NEXT b
produced
105 98 10290
75 98 7350
98 105 10290
98 75 7350
in under 13 seconds.
|
Posted by Charlie
on 2007-10-28 11:43:48 |