Private Sub Command1_Click()
Dim a, b, c As Integer
Dim aa, bb, cc As Double
For i = 2 To 10000
a = i
b = a + 1
c = b + 1
cc = Arccos((a ^ 2 + b ^ 2 - c ^ 2) / (2 * a * b))
bb = Arccos((a ^ 2 + c ^ 2 - b ^ 2) / (2 * a * c))
aa = Arccos((c ^ 2 + b ^ 2 - a ^ 2) / (2 * b * c))
If aa <> 0 And bb / aa = 2 Or cc / aa = 2 Then Print a, b, c
If bb <> 0 And aa / bb = 2 Or cc / bb = 2 Then Print a, b, c
If cc <> 0 And bb / cc = 2 Or aa / cc = 2 Then Print a, b, c
Next i
End Sub
Private Function Arccos(ByVal x As Single) As Single
If x = 0 Then
Arccos = 3.1415926 / 2
Else
Arccos = Atn(Sqr(1 - x ^ 2) / x)
If Arccos < 0 Then
Arccos = Arccos + 3.1415926
End If
End If
End Function作者: superacid 时间: 2012-2-8 13:38:48