This 5-digit number N uses only ones and zeros if represented in each of the following bases: 3;4;5; and of course the trivial 1 (N ones) 2(no other choices) and N (10).
a. What is N?
b. How many distinct digits are used in its base-6 form?
clc, clearvars
for N=10000:99999
b3=dec2base(N,3);
if isequal(union(b3,'01'),'01')
b4=dec2base(N,4);
if isequal(union(b4,'01'),'01')
b5=dec2base(N,5);
if isequal(union(b5,'01'),'01')
fprintf('%5d %5s %5s %5s %5s %5s\n',N,dec2base(N,2),b3,b4,b5,dec2base(N,6));
end
end
end
end
shows
82000 10100000001010000 11011111001 110001100 10111000 1431344
giving the value in decimal, binary, base-3, base-4, base-5 and base-6.
As seen, the base-6 representation uses three different digits: 1, 3, and 4.
|
Posted by Charlie
on 2022-02-24 09:02:13 |