DefDbl A-Z
Dim crlf$, n(4)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 1 To 496
n(1) = a
addOn 2
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Sub addOn(wh)
For newNum = n(wh - 1) + 1 To 499
n(wh) = newNum
good = 1
For i = 1 To wh - 1
For j = i + 1 To wh
DoEvents
sq = n(i) * n(j) + 1
sr = Int(Sqr(sq) + 0.5)
If sr * sr <> sq Then good = 0: Exit For
Next
If good = 0 Then Exit For
Next
If good Then
If wh = 4 Then
For i = 1 To 4
Text1.Text = Text1.Text & Str(n(i))
Next
Text1.Text = Text1.Text & crlf
Else
addOn wh + 1
End If
End If
Next
End Sub
finds these two solutions:
1 3 8 120
2 4 12 420
|
Posted by Charlie
on 2016-12-04 11:01:08 |