Let ABC be a triangle with integral side lengths such that angle A=3 * angle B. Find the minimum value of its perimeter.
The minimum value of the perimeter is 21 (10:8:3 triangle):
DefDbl A-Z
Dim fct(20, 1), crlf$
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
For peri = 3 To 100
For a = Int(peri / 2) To peri / 4 Step -1
For b = 1 To a - 1
c = peri - a - b
If a + b > c And a + c > b And b + c > a Then
cosa = (-a * a + b * b + c * c) / (2 * b * c)
If Abs(cosa) < 1 Then
anglea = acos(cosa)
cosb = (-b * b + a * a + c * c) / (2 * a * c)
If Abs(cosb) < 1 Then
angleb = acos(cosb)
rat = anglea / angleb: ratround = Int(rat + 0.5)
If Abs(ratround - rat) < 0.000001 And ratround = 3 Then
Text1.Text = Text1.Text & a & Str(b) & Str(c) & " " & peri & Str(rat)
Text1.Text = Text1.Text & " " & anglea * 180 / (4 * Atn(1)) & Str(angleb * 180 / (4 * Atn(1))) & crlf
DoEvents
End If
End If
End If
End If
Next
Next
Next
Text1.Text = Text1.Text & "done"
DoEvents
End Sub
Function acos(x)
If x = 0 Then acos = 2 * Atn(1): Exit Function
ac = Atn(Sqr(1 - x * x) / x)
If ac > 0 Then acos = ac Else acos = ac + 4 * Atn(1)
End Function
finds
10 8 3 21 3 124.228866327813 41.4096221092709
20 16 6 42 3 124.228866327813 41.4096221092709
30 24 9 63 3 124.228866327813 41.4096221092709
40 32 12 84 3 124.228866327813 41.4096221092709
showing for each: three sides, a, b and c; perimeter; ratio of angles; and the measures of the angles in degrees.
|
Posted by Charlie
on 2015-03-04 09:33:20 |