In a certain multiplication sample all the digits were replaced by their mod 3 value (e.g. 875 became 212),rendering:
1202*102=222210
Please restore the original sample and either show that there are no others or provide extra solutions.
DEFDBL A-Z
OPEN "mod 3 alphametics.txt" FOR OUTPUT AS #2
FOR a = 1 TO 9 STEP 3
FOR b = 2 TO 9 STEP 3
FOR c = 0 TO 9 STEP 3
FOR d = 2 TO 9 STEP 3
FOR e = 1 TO 9 STEP 3
FOR f = 0 TO 9 STEP 3
FOR g = 2 TO 9 STEP 3
m1 = 1000 * a + 100 * b + 10 * c + d
m2 = 100 * e + 10 * f + g
prod = m1 * m2
prods$ = LTRIM$(STR$(prod))
IF LEN(prods$) = 6 THEN
good = 1
FOR i = 1 TO 6
v1 = VAL(MID$(prods$, i, 1)) MOD 3
v2 = VAL(MID$("222210", i, 1))
IF v1 <> v2 THEN good = 0
NEXT
IF good THEN
PRINT m1; m2, prod
PRINT #2, m1; m2, prod
END IF
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
CLOSE
finds
1202 435 522870
1268 462 585816
1292 198 255816
1505 168 252840
1598 162 258876
1832 138 252816
1898 465 882570
4232 195 825240
4265 138 588570
4298 192 825216
4595 192 882240
4598 192 882816
7862 105 825510
|
Posted by Charlie
on 2014-04-15 16:21:51 |