Solve
separately each of these base ten
alphametics. None of the numbers (including those covered under functions) corresponding to any of the following alphametics can contain leading zero.
(I)
THOMAS+
MALTHUS+1766+1834+
RR=
RRRRRRR, whenever
MOST is divisible by 23.
(II)
DINAH+
SHORE+1916+1994+
TT=
TTTTT, where:
sod(
DEAR)/sod(
HEARTS) = 2/3 and, dr(
ROSE) = 4
(III)
BENNY+
BELL+1906+1999+
BBB=
DR+
DE+
MENTO, where:
sod(
TRY)/sod(
BLEND) = 4/9
Note:sod(x) denotes the sum of digits of x and dr(x) denotes the
digital root of x.
CLS
FOR t = 1 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR m = 1 TO 9
IF used(m) = 0 THEN
used(m) = 1
FOR r = 1 TO 9
IF used(r) = 0 THEN
used(r) = 1
FOR h = 0 TO 9
IF used(h) = 0 THEN
used(h) = 1
FOR o = 0 TO 9
IF used(o) = 0 THEN
used(o) = 1
FOR a = 0 TO 9
IF used(a) = 0 THEN
used(a) = 1
FOR s = 0 TO 9
IF used(s) = 0 THEN
used(s) = 1
thomas = t * 100000 + h * 10000 + o * 1000 + m * 100 + a * 10 + s
rr = r * 11
rrrrrrr = r * 1111111
malthus = rrrrrrr - rr - 1834 - 1766 - thomas
t$ = LTRIM$(STR$(thomas))
m$ = LTRIM$(STR$(malthus))
IF LEN(m$) = 7 THEN
IF MID$(t$, 1, 1) = MID$(m$, 4, 1) THEN
IF MID$(t$, 2, 1) = MID$(m$, 5, 1) THEN
IF MID$(t$, 4, 1) = MID$(m$, 1, 1) THEN
IF MID$(t$, 5, 1) = MID$(m$, 2, 1) THEN
IF MID$(t$, 6, 1) = MID$(m$, 7, 1) THEN
IF used(VAL(MID$(m$, 3, 1))) = 0 AND used(VAL(MID$(m$, 6, 1))) = 0 THEN
IF MID$(m$, 3, 1) <> MID$(m$, 6, 1) THEN
most = m * 1000 + o * 100 + s * 10 + t
IF most MOD 23 = 0 THEN
PRINT thomas; malthus, r
END IF
END IF
END IF
END IF
END IF
END IF
END IF
END IF
END IF
used(s) = 0
END IF
NEXT
used(a) = 0
END IF
NEXT
used(o) = 0
END IF
NEXT
used(h) = 0
END IF
NEXT
used(r) = 0
END IF
NEXT
used(m) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
finds
THOMAS MALTHUS R
840135 1378465 2
|
Posted by Charlie
on 2010-07-25 13:14:22 |