AZA
x AZZA
---------
AZZZZZA
Substitute a single digit for Z. Substitute any digit for each A. The number for Z must be different from the numbers for A. There are no leading zeros. What are the possible solutions?
DEFDBL A-Z
CLS
FOR z = 0 TO 9
FOR a1 = 1 TO 9
IF a1 <> 0 THEN
FOR a2 = 0 TO 9
IF a2 <> z THEN
m1 = 100 * a1 + 10 * z + a2
FOR a3 = 1 TO 9
IF a3 <> z THEN
FOR a4 = 0 TO 9
IF a4 <> z THEN
m2 = 1000 * a3 + 110 * z + a4
FOR a5 = 1 TO 9
IF a5 <> z THEN
FOR a6 = 0 TO 9
IF a6 <> z THEN
p = 1000000 * a5 + 111110 * z + a6
IF m1 * m2 = p THEN
PRINT m1: PRINT m2: PRINT p
END IF
END IF
NEXT
END IF
NEXT
END IF
NEXT
END IF
NEXT
END IF
NEXT
END IF
NEXT
NEXT
finds
723
7223
5222229
and
645
8441
5444445
|
Posted by Charlie
on 2014-01-31 22:00:07 |