Each of A, B, and C is a different
zeroless pandigital number that satisfy this equation:
A*B=C2
Determine the minimum value of C.
(In reply to
Solution by Larry)
I admire your solution. Great logic.
I've translated it into Matlab:
clearvars
pand=perms('123456789');
for i=1:size(pand,1)
pands(i)=uint64(str2double(pand(i,:)));
end
pands=sort(pands);
sqs=pands.^2;
for s=1:length(sqs)
sq=sqs(s);
c=floor(sqrt(double(sq)));
c=uint64(c);
for p=1:length(pands)
a=pands(p);
if a>=c
break
end
if mod(sq,a)==0 && a~=c
b=sq/a;
if ismember(b,pands)
disp([a b c c^2])
end
end
end
end
and show the first few lines of output:
A B C C^2
164938572 325196748 231597684 53637487234163856
123456789 493827156 246913578 60966315000762084
123456879 493827516 246913758 60966403889682564
123784569 495138276 247569138 61290478090063044
123794658 495178632 247589316 61300469397347856
123795684 495182736 247591368 61301485508111424
123845679 495382716 247691358 61351008827884164
123946578 495786312 247893156 61451016791640336
123956784 495827136 247913568 61461137198490624
124379658 497518632 248759316 61881197296787856
124396578 497586312 248793156 61898034472440336
124567839 498271356 249135678 62068586052519684
124568379 498273516 249136758 62069124186750564
124657893 498631572 249315786 62158361148797796
124657938 498631752 249315876 62158406025647376
124658793 498635172 249317586 62159258688867396
124659378 498637512 249318756 62159842093387536
154723968 417596832 254189376 64612238871269376
128356974 513427896 256713948 65902051097746704
128357469 513429876 256714938 65902559392343844
128369574 513478296 256739148 65914990115765904
128374569 513498276 256749138 65920119863743044
128457369 513829476 256914738 66005182601608644
128473569 513894276 256947138 66021831726391044
128493567 513974268 256987134 66042387041533956
128493657 513974628 256987314 66042479556934596
128569734 514278936 257139468 66120706003323024
128573469 514293876 257146938 66124547722775844
128594673 514378692 257189346 66146359695907716
128596743 514386972 257193486 66148489240832196
128659473 514637892 257318946 66213039970550916
128659743 514638972 257319486 66213317875304196
128674593 514698372 257349186 66228603534862596
128695734 514782936 257391468 66250367799195024
128734569 514938276 257469138 66290357022463044
128746593 514986372 257493186 66302740836430596
129348567 517394268 258697134 66924207139813956
129348657 517394628 258697314 66924300270814596
129367458 517469832 258734916 66943756757527056
129374658 517498632 258749316 66951208530467856
129458673 517834692 258917346 67038192059683716
129465873 517863492 258931746 67045649086608516
129467358 517869432 258934716 67047187150000656
129473658 517894632 258947316 67053712463603856
129483567 517934268 258967134 67063976492173956
129483657 517934628 258967314 67064069720374596
129568374 518273496 259136748 67151854164015504
129568734 518274936 259137468 67152227321451024
129573684 518294736 259147368 67157358341327424
129586743 518346972 259173486 67170895845392196
129658743 518634972 259317486 67245558545360196
129674358 518697432 259348716 67261756490848656
129683574 518734296 259367148 67271317461653904
129685734 518742936 259371468 67273558412475024
129735684 518942736 259471368 67325390811791424
129743658 518974632 259487316 67333667164883856
129843567 519374268 259687134 67437407565133956
129843657 519374628 259687314 67437501052534596
I had no idea it could be done so fast. ... or that there were so many solutions.
|
Posted by Charlie
on 2023-01-06 14:11:39 |