XYZ is a 3-digit number. If you multiply it by 2 ten times, then you will get a number that only uses the digits X, Y, and Z. Find all possible values of XYZ.
clc,clearvars
for n=100:999
digs=unique(char(string(n)));
n2=n*1024;
digs2=unique(char(string(n2)));
if all(ismember(digs2,digs))
if ~isequal(digs2,digs)
fprintf('* ');
end
fprintf('%d ',n,n2);
fprintf('
');
end
end
finds the following five 3-digit numbers, shown with their product when multiplied by 1024:
431 441344
* 436 446464
523 535552
650 665600
862 882688
In one of these cases, 436, marked with an asterisk, not all three digits are used in the multiple, but indeed the product does use only digits in the original.
Edited on January 31, 2023, 2:41 pm
|
Posted by Charlie
on 2023-01-10 09:05:17 |