Triangle ABC has integer side lengths for which some ordering of the lengths of all three of its medians form a right triangle. Find the minimum possible perimeter of triangle ABC.
The minimum perimeter for triangle ABC is 54, with side lengths of 13, 19, and 22. Its medians are of lengths 12, 3*sqrt(105)/2 =~ 15.370426148939397, and 19.5, which can form a right triangle.
The program works in double precision for speed; then, when it finds a valid set, it confirms the calculation using extended precision before displaying the result. The 20 lowest-perimeter cases are presented in a table below.
clc,clearvars
ct=0;
for tot=3:1000
for a= 1:tot/3
for b=a:(tot-a)/2
tri2=[a b];
c=tot-a-b;
tri=[tri2 c].^2; % sides are squared for use in median formula
for s=1:3
m(s)=sqrt(2*sum(tri(2:3))-tri(1))/2; % uses Apollonius' theorem
tri=[tri(3) tri([1 2])];
end
m=sort(m);
diff=m(3)^2-m(1)^2-m(2)^2;
if abs(diff)<.00001 && m(1)>.000001
tri=vpa(tri);
for s=1:3
m(s)=sqrt(2*sum(tri(2:3))-tri(1))/2;
tri=[tri(3) tri([1 2])];
end
m=sort(m);
diff=m(3)^2-m(1)^2-m(2)^2;
if abs(diff)<.000000000000001
fprintf('%4d %4d %4d %4d %14.10f %14.10f %14.10f %13.10f\n',[a b c tot m diff])
ct=ct+1;
end
end
end
end
if ct>=20
break
end
end
triangle
sides peri- medians
------------ meter --------------------------------------------
13 19 22 54 12.0000000000 15.3704261489 19.5000000000
17 22 31 70 12.0933866224 22.4499443206 25.5000000000
25 38 41 104 24.7840674628 28.1424945589 37.5000000000
26 38 44 108 24.0000000000 30.7408522979 39.0000000000
34 44 62 140 24.1867732449 44.8998886413 51.0000000000
50 76 82 208 49.5681349256 56.2849891179 75.0000000000
51 66 93 210 36.2801598673 67.3498329619 76.5000000000
52 76 88 216 48.0000000000 61.4817045958 78.0000000000
53 62 101 216 27.8612634315 74.4580418759 79.5000000000
68 88 124 280 48.3735464898 89.7997772826 102.0000000000
75 114 123 312 74.3522023884 84.4274836768 112.5000000000
85 118 149 352 70.8819441043 105.9811303959 127.5000000000
89 121 158 368 70.9929573972 113.0586131173 133.5000000000
91 133 154 378 84.0000000000 107.5929830426 136.5000000000
100 152 164 416 99.1362698511 112.5699782358 150.0000000000
101 139 178 418 82.7042925125 126.9340379882 151.5000000000
102 132 186 420 72.5603197347 134.6996659239 153.0000000000
104 152 176 432 96.0000000000 122.9634091915 156.0000000000
106 124 202 432 55.7225268630 148.9160837519 159.0000000000
117 171 198 486 108.0000000000 138.3338353405 175.5000000000
|
Posted by Charlie
on 2025-04-17 12:01:08 |