The following alphametic summation puzzle:
WORDS
+WORDS
+WORDS
-----------
AVOWED
has a unique solution in base 10.
Find it.
Is there a solution in base 8?
DECLARE SUB permute (a$)
CLS
a$ = "1234567890": h$ = a$
DO
IF INSTR(a$, "0") > 2 THEN
w = VAL(MID$(a$, 1, 1))
a = VAL(MID$(a$, 2, 1))
o = VAL(MID$(a$, 3, 1))
r = VAL(MID$(a$, 4, 1))
d = VAL(MID$(a$, 5, 1))
s = VAL(MID$(a$, 6, 1))
v = VAL(MID$(a$, 7, 1))
e = VAL(MID$(a$, 8, 1))
END IF
words = 10000 * w + 1000 * o + 100 * r + 10 * d + s
avowed = 100000 * a + 10000 * v + 1000 * o + 100 * w + 10 * e + d
IF 3 * words = avowed THEN
PRINT words, avowed
END IF
permute a$
LOOP UNTIL a$ = h$
a$ = "12345670": h$ = a$
DO
IF INSTR(a$, "0") > 2 THEN
w = VAL(MID$(a$, 1, 1))
a = VAL(MID$(a$, 2, 1))
o = VAL(MID$(a$, 3, 1))
r = VAL(MID$(a$, 4, 1))
d = VAL(MID$(a$, 5, 1))
s = VAL(MID$(a$, 6, 1))
v = VAL(MID$(a$, 7, 1))
e = VAL(MID$(a$, 8, 1))
END IF
words = 8 * 8 * 8 * 8 * w + 8 * 8 * 8 * o + 8 * 8 * r + 8 * d + s
avowed = 8 * 8 * 8 * 8 * 8 * a + 8 * 8 * 8 * 8 * v + 8 * 8 * 8 * o + 8 * 8 * w + 8 * e + d
IF 3 * words = avowed THEN
PRINT words, avowed
END IF
permute a$
LOOP UNTIL a$ = h$
finds
34786 104358
for WORDS and AVOWED respectively in base 10.
None are found for base 8.
|
Posted by Charlie
on 2014-01-07 18:05:03 |