Scalenia is a country bounded by
three straight frontiers called A, B,
and C, of course, each of a different
length but each an exact number of
kilometers long.
The curious thing is
that the length of A+B+C, and
the lengths of A+B-C, A+C-B, and
B+C-A, are all precisely square
numbers of kilometers.
If Scalenia
has the smallest perimeter consistent with this curious fact, what is
the length of each of its frontiers?
Note also that all side lengths must be distinct.
(A,B,C) is (26,80,90)
The first few:
A B C perim √p
square roots of differences
26 80 90 196 14.0
4.0 6.0 12.0
34 130 160 324 18.0
2.0 8.0 16.0
80 170 234 484 22.0
4.0 12.0 18.0
--------
def canBeTri(a,b,c):
if min([a,b,c]) <= 0:
return False
if a>=c+b:
return False
if b>=a+c:
return False
if c>=a+b:
return False
return True
big = 400
bigroot = int((2*big)**.5)
squares = [n**2 for n in range(1,bigroot+1)]
for a in range(1,big):
for b in range(a+1,big):
for c in range(b+1,big):
p = a+b+c
if p>500:
continue
if not canBeTri(a,b,c):
continue
if a+b+c not in squares:
continue
if a+b-c not in squares:
continue
if a+c-b not in squares:
continue
if b+c-a not in squares:
continue
print(a,b,c,a+b+c,(a+b+c)**.5)
print((a+b-c)**.5, (a-b+c)**.5, (-a+b+c)**.5)
print()
|
Posted by Larry
on 2025-02-04 11:43:52 |