Checking integers from -1,000,000 to 1,000,000 finds only
x val sqrt
0 1 1
-1 0 0
1 4 2
7 400 20
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For x0 = 0 To 1000000
st = 2 * x0: fin = x0
If st = 0 Then st = 1
For x = -x0 To fin Step st
DoEvents
sq = (1 + x) * (1 + x * x)
If sq >= 0 Then
sr = Int(Sqr(sq) + 0.5)
If sr * sr = sq Then
Text1.Text = Text1.Text & x & Str(sq) & Str(sr) & crlf
End If
End If
Next x
Next x0
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2016-11-12 10:59:45 |