Compile a list of all square integers below 10,000, not terminating by zero, such that erasing their two last digits creates a new square number.
for sr=1:9999999
sq=sr*sr;
s=num2str(sq);
l=length(s);
if l>=3
s2=s(1:l-2);
if ~isequal(s(l),'0')
sq2=str2num(s2);
sr2=round(sqrt(sq2));
if sr2*sr2==sq2
disp(sq)
end
end
end
end
121
144
169
196
441
484
961
1681
Numbers almost all the way to 10^14 that were squares (of numbers up to almost 10^7) were tested, leading one to believe that the list is exhaustive, and all such numbers are below 10,000.
|
Posted by Charlie
on 2021-05-18 09:05:59 |