Concatenating two consecutive integers
183 and 184
we get a six-digit number
183184, equalling
square of 428.List similar pairs, below
500,000 (final product).
How about the same task with a pair of a consecutve numbers
in a decreasing order?
Please provide a similar list (same constraints).
lim=floor(sqrt(500000));
for i=1:lim
sq=str2num([char(string(i)) char(string(i+1))]);
sr=round(sqrt(sq));
if sr*sr==sq
disp([i i+1 sr]);
end
end
disp(' ')
for i=1:lim
sq=str2num([char(string(i+1)) char(string(i))]);
sr=round(sqrt(sq));
if sr*sr==sq
disp([i+1 i sr]);
end
end
finds
concat's
two numbers square
root
183 184 428
328 329 573
528 529 727 actually 528529 exceeds the 500,000 limit
82 81 91
Since the computer is doing the grunt work, we can extend further:
183 184 428
328 329 573
528 529 727
715 716 846
6099 6100 7810
13224 13225 36365
40495 40496 63636
106755 106756 326734
453288 453289 673267
2066115 2066116 4545454
2975208 2975209 5454547
82 81 91
8242 8241 9079
9802 9801 9901
538277 538276 733674
998002 998001 999001
Descending always seems to find fewer.
|
Posted by Charlie
on 2021-08-19 10:45:11 |