Any three of the integers {1, X, Y, Z} add up to a perfect square.
What are X, Y, & Z?
Hint: each is below 100.
(1, 8, 8, 8)
n(1) = 1
For x = 1 To 100
n(2) = x
For y = x To 100
n(3) = y
For z = y To 100
n(4) = z
good = 1
For a = 1 To 3
For b = a + 1 To 4
sq = n(a) + n(b)
sr = Int(Sqr(sq) + 0.5)
If sr * sr <> sq Then
good = 0: Exit For
End If
Next
If good = 0 Then Exit For
Next
If good Then
For i = 1 To 4
Text1.Text = Text1.Text & Str(n(i))
Next
Text1.Text = Text1.Text & crlf
End If
DoEvents
Next
Next
Next
|
Posted by Charlie
on 2018-01-10 14:04:44 |