DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For tot = 2 To 62
For x = 1 To tot / 2
DoEvents
y = tot - x
If x < 32 And y < 32 Then
v1 = Int(3 ^ x + 1.5)
v2 = Int(3 ^ y + 1.5)
d = x * y
q1 = Int(v1 / d): r1 = v1 - q1 * d
q2 = Int(v2 / d): r2 = v2 - q2 * d
If r1 = 0 And r2 = 0 Then
Text1.Text = Text1.Text & x & Str(y) & " " & v1 & Str(v2)
Text1.Text = Text1.Text & " " & Str(d) & crlf
End If
End If
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
finds only
i.e., (x,y) = (1,1) or (1,2), giving expression values of (4,4) or (4,10) respectively and products equal to 1 and 2.
Restrictions on x and y to at most 31 as 32 would risk rounding errors in the powers as going beyond the precision of double precision floating point.
|
Posted by Charlie
on 2015-09-20 07:56:20 |