First equation roots:
x = (A +/- sqrt(A^2 - 4*B) / 2
Second equation roots:
x = (B +/- sqrt(B^2 - 4*A) / 2
4*B <= A^2
4*A <= B^2
4*sqrt(A) <= A^2, remembering A is positive
4*sqrt(A) <= (sqrt(A))^4
(sqrt(A))^3 >= 4
A >= 2.5198... and since integer, >= 3
Same for B
sqrt(A^2 - 4*B) must be of same parity as A, and must be smaller than A so as to make both roots positive. (Each equation must have positive roots -- singular equation, plural roots).
The same with sqrt(B^2 - 4*A) vs B.
Found that satisfy:
A B roots
4 4 2 2
5 6 4.5 4.5
Also B and A can be interchanged due to the symmetry of the equations. The roots would be reversed as well, but the roots are the same in each case.
However, 4.5 is not an integer so A=4; B=4 would seem the only pair.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For tot = 6 To 10000
For a = 3 To tot / 2
b = tot - a
If 4 * b <= a * a Then
If 4 * a <= b * b Then
tst = Sqr(a * a - 4 * b)
If tst = Int(tst) And (tst - a) Mod 2 = 0 And tst < a Then
tst = Sqr(b * b - 4 * a)
If tst = Int(tst) And (tst - b) Mod 2 = 0 And tst < b Then
Text1.Text = Text1.Text & a & Str(b) & " "
Text1.Text = Text1.Text & (a + tst) / 2 & Str((a + tst) / 2) & crlf
End If
End If
End If
End If
DoEvents
Next a
Next tot
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2016-10-18 16:18:25 |