A four digit positive decimal number DEEP ( in which each of the letters D, E and P represent a different digit) is expressed in base 7, base 6 and base 5. Treating these expressions as decimal numbers, we add them together and observe that the total is 20000. What does DEEP represent?
Another four digit positive decimal number ROOT ( in which each of the letters R, O and T represent a different digit) is expressed in base 7, base 6 and base 5. Treating these expressions as decimal numbers, we add them together and observe that the total is 54321. What does ROOT represent?
When 1006 is expressed in bases 7, 6 and 5, the representations are:
base representation
7 2635
6 4354
5 13011
When those representations are treated as if they were decimal, the total is 20,000.
When 2337 is expressed in bases 7, 6 and 5, the representations are:
base representation
7 6546
6 14453
5 33322
When those representations are treated as if they were decimal, the total is 54,321.
FOR d = 1 TO 9
FOR e = 0 TO 9
IF e <> d THEN
FOR p = 0 TO 9
IF p <> d AND p <> e THEN
deep = d * 1000 + e * 110 + p
n = deep
b7$ = ""
DO
r = n MOD 7
n = n \\ 7
b7$ = LTRIM$(STR$(r)) + b7$
LOOP UNTIL n = 0
n = deep
b6$ = ""
DO
r = n MOD 6
n = n \\ 6
b6$ = LTRIM$(STR$(r)) + b6$
LOOP UNTIL n = 0
n = deep
b5$ = ""
DO
r = n MOD 5
n = n \\ 5
b5$ = LTRIM$(STR$(r)) + b5$
LOOP UNTIL n = 0
tot = VAL(b7$) + VAL(b6$) + VAL(b5$)
IF tot = 20000 THEN
PRINT d; e; e; p
b7$ = RIGHT$(SPACE$(6) + b7$, 5)
b6$ = RIGHT$(SPACE$(6) + b6$, 5)
b5$ = RIGHT$(SPACE$(6) + b5$, 5)
PRINT 7; b7$: PRINT 6; b6$: PRINT 5; b5$
END IF
END IF
NEXT
END IF
NEXT
NEXT
Since variable names are not important, the same program works for the second part, just by replacing the 20000 with 54321.
Edited on September 17, 2006, 2:00 pm

Posted by Charlie
on 20060917 13:55:22 