A certain 10-base integer with distinct digits can be converted to base b by merely reversing its digits.
Find the lowest value of b.
DEFDBL A-Z
CLS
FOR b = 3 TO 9
FOR d1 = 0 TO b - 1
FOR d2 = 0 TO b - 1
IF d1 * 10 + d2 = d2 * b + d1 AND d1 + d2 > 0 THEN PRINT b, d1; d2
NEXT d2
NEXT d1
NEXT b
finds for 2-digit numbers with bases under 10:
b decimal digits to be reversed
4 1 3
7 2 3
7 4 6
So the smallest b seems to be 4, where 13 decimal can be represented as 31.
Going to 3-digit numbers would not seem to be able to lower b to 3, as the highest 3-digit base-3 number would be represented as 222 and be the equivalent to 18+6+2=26 decimal, which is only a 2-digit number.
|
Posted by Charlie
on 2011-03-30 13:02:15 |