(A) Two different five digit base ten numbers M and N are constituted entirely by even digits.
What is the least value of M+N, given that M*N is a perfect square?
(B) Two different five digit numbers M and N are constituted entirely by odd digits.
What is the least value of M+N, given that M*N is a perfect square?
(A)
clearvars,clc
for i=18000: 2:200000
sq=i*i;
tbl=divisors(sq);
l=length(tbl);
for j=1:floor(l/2)
if tbl(j)>9999
row=[char(string(tbl(j))) char(string(tbl(l+1-j)))];
evens=setdiff('13579',row);
odds=setdiff('02468',row);
if length(evens)==5 || length(odds)==5
disp([tbl(j) tbl(l+1-j) tbl(j) + tbl(l+1-j) ])
end
end
end
end
finds the first few at
M N sum
20000 20402 40402
20000 20808 40808
20402 20808 41210
20286 22264 42550
20000 24200 44200
20000 24642 44642
20200 24442 44642
20402 24200 44602
20088 24800 44888
20402 24642 45044
20400 24684 45084
20808 24200 45008
20808 24642 45450
20608 26082 46690
20864 26406 47270
20000 28800 48800
22022 26208 48230
22000 26620 48620
20402 28800 49202
20480 28880 49360
20880 28420 49300
22646 26264 48910
22200 26862 49062
24200 24642 48842
20808 28800 49608
22680 28000 50680
24000 26460 50460
22842 28200 51042
24200 28800 53000
24642 28800 53442
26244 28224 54468
20000 44402 64402
20286 44206 64492
20402 44402 64804
22626 40224 62850
22662 40288 62950
22400 40824 63224
20808 44402 65210
20000 46208 66208
22842 40608 63450
22860 40640 63500
20448 46008 66456
20464 46044 66508
20402 46208 66610
20480 46080 66560
20624 46404 67028
20640 46440 67080
20808 46208 67016
20886 46464 67350
20280 48000 68280
20800 46800 67600
20088 48608 68696
20480 48020 68500
22264 44206 66470
24624 40204 64828
20886 48600 69486
22800 44688 67488
26244 40000 66244
26244 40804 67048
24200 44402 68602
24642 44402 69044
24200 46208 70408
26880 42000 68880
28224 40000 68224
24448 46222 70670
24642 46208 70850
28200 40608 68808
28224 40804 69028
so 20000 and 20402, summing to 40402 would be the answer for evens.
20000 * 20402 = 408040000 whose square root is 20200.
(B)
clearvars,clc
for i=11001: 2:100001
sq=i*i;
tbl=divisors(sq);
l=length(tbl);
for j=1:floor(l/2)
if tbl(j)>9999
row=[char(string(tbl(j))) char(string(tbl(l+1-j)))];
evens=setdiff('13579',row);
odds=setdiff('02468',row);
if length(evens)==5 || length(odds)==5
disp([tbl(j) tbl(l+1-j) tbl(j) + tbl(l+1-j)])
end
end
end
end
finds the first few for odd digits are:
M N sum
11999 15975 27974
11191 19375 30566
11711 19359 31070
13351 17775 31126
13357 19573 32930
15317 19133 34450
17797 19773 37570
11511 31975 43486
11999 31311 43310
11191 33759 44950
11913 31713 43626
13357 31117 44474
11191 37975 49166 ...
I think it's safe to say 11999 + 15975 = 27974 is the lowest sum.
11999*15975= 191684025 whose square root is 13845.
|
Posted by Charlie
on 2023-09-08 11:37:35 |