Find all triplets (X,Y,Z) of positive integers that satisfy this system of equations:
lcm(X,Y,Z) + Y +Z = 426, and:
X + gcd(X,Y,Z) + Z = 66, and:
X+Y+Z =90
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For totxy = 2 To 89
For x = 1 To totxy - 1
y = totxy - x
z = 90 - totxy
If lcm(lcm(x, y), z) + y + z = 426 Then
If x + gcd(gcd(x, y), z) + z = 66 Then
Text1.Text = Text1.Text & x & Str(y) & Str(z) & crlf
End If
End If
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function gcd(a, b)
x = a: y = b
Do
q = Int(x / y)
z = x - q * y
x = y: y = z
Loop Until z = 0
gcd = x
End Function
Function lcm(a, b)
lcm = a * b / gcd(a, b)
End Function
finds
|
Posted by Charlie
on 2016-05-03 19:05:37 |