Two (non leading zero) five digit positive integers A and B together uses the digits 0 to 9 exactly once, with B=3*A
What are A and B, if the concatenated form of the first three digits of B is a perfect square?
clearvars,clc
digs='0123456789';
prm=combinator(10,5,'p');
As=digs(prm);
for i=1:length(As)
A=As(i,:);
B=char(string(3*str2double(A)));
AB=[A B];
if isequal(sort(AB),unique(AB))
sq=str2double(B(1:3));
sr=sqrt(sq);
if sr==round(sr)
disp([A ' ' B])
end
end
end
finds
32058 96174
where the latter is 3 times the former and 961 = 31^2.
|
Posted by Charlie
on 2023-06-08 12:02:15 |