A number AABCBC is the square of an integer. Find all possible values of AABCBC.
clc
for n=floor(sqrt(100000)):ceil(sqrt(999999))
s=char(string(n^2));
a=s(1);
if isequal(strfind(s,a),[1 2])
b=s(3);
if isequal(strfind(s,b),[3 5]);
c=s(4);
if isequal(strfind(s,c),[4 6]);
disp([n n^2])
end
end
end
end
finds
n n^2
478 228484
577 332929
881 776161
|
Posted by Charlie
on 2022-11-26 09:06:15 |