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.
DECLARE FUNCTION dr# (x#)
DECLARE FUNCTION sod# (x#)
DEFDBL A-Z
FOR d = 1 TO 9
IF used(d) = 0 THEN
used(d) = 1
FOR s = 1 TO 9
IF used(s) = 0 THEN
used(s) = 1
FOR t = 1 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR i = 0 TO 9
IF used(i) = 0 THEN
used(i) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR a = 0 TO 9
IF used(a) = 0 THEN
used(a) = 1
FOR h = 0 TO 9
IF used(h) = 0 THEN
used(h) = 1
tt = t * 11
ttttt = t * 11111
dinah = d * 10000 + i * 1000 + n * 100 + a * 10 + h
shore = ttttt - tt - 1994 - 1916 - dinah
d$ = LTRIM$(STR$(dinah))
s$ = LTRIM$(STR$(shore))
IF LEN(s$) = 5 THEN
IF MID$(d$, 5, 1) = MID$(s$, 2, 1) AND VAL(MID$(s$, 1, 1)) = s THEN
o = VAL(MID$(s$, 3, 1))
r = VAL(MID$(s$, 4, 1))
e = VAL(MID$(s$, 5, 1))
IF used(o) = 0 AND used(r) = 0 AND used(e) = 0 THEN
dear = d * 1000 + e * 100 + a * 10 + r
hearts = h * 100000 + e * 10000 + a * 1000 + r * 100 + t * 10 + s
rose = r * 1000 + o * 100 + s * 10 + e
IF 3 * sod(dear) = 2 * sod(hearts) AND dr(rose) = 4 THEN
PRINT dinah; shore, t
END IF
END IF
END IF
END IF
used(h) = 0
END IF
NEXT
used(a) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
used(i) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
used(s) = 0
END IF
NEXT
used(d) = 0
END IF
NEXT
FUNCTION dr (x)
v = x
DO
v = sod(v)
LOOP UNTIL v < 10
dr = v
END FUNCTION
FUNCTION sod (x)
xs$ = LTRIM$(STR$(x))
t = 0
FOR i = 1 TO LEN(xs$)
t = t + VAL(MID$(xs$, i, 1))
NEXT
sod = t
END FUNCTION
finds
DINAH SHORE T
16903 23587 4
|
Posted by Charlie
on 2010-07-25 13:54:53 |