DECLARE SUB permute (a$)
DEFDBL A-Z
CLS
a$ = "1234567890": h$ = a$
DO
IF INSTR(a$, "0") > 3 THEN
w = VAL(MID$(a$, 1, 1))
m = VAL(MID$(a$, 2, 1))
p = VAL(MID$(a$, 3, 1))
o = VAL(MID$(a$, 4, 1))
e = VAL(MID$(a$, 5, 1))
n = VAL(MID$(a$, 6, 1))
r = VAL(MID$(a$, 7, 1))
b = VAL(MID$(a$, 8, 1))
l = VAL(MID$(a$, 9, 1))
men = 100 * m + 10 * e + n
women = 10000 * w + 1000 * o + men
problem = 1000000 * p + 100000 * r + 10000 * o + 1000 * b + 100 * l + 10 * e + m
IF men * women = problem THEN
PRINT men; "*"; women; "="; problem
END IF
END IF
permute a$
LOOP UNTIL a$ = h$
finds
169 * 20169 = 3408561
which is missing a 7.
|
Posted by Charlie
on 2014-02-15 15:49:39 |