The set (1,3,8) has this peculiar feature:
Multiply any two of these numbers together and add 1 and you'll always get a perfect square:
1+ 1 × 3 = 4
1 + 1 × 8 = 9
1 + 3 × 8 = 25
a. Add to the above set a 4th integer, thus enabling 3 additional equalities.
b. Can you show why no 5th member maintaining the above feature exists?
In order to work with set member 1, each such number except 1 has to be 1 less than a perfect square.
The program tests all such numbers up to 1 less than 10,000,000^2 for compatibility with 3 and 8:
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For rt = 4 To 10000000
DoEvents
n = rt * rt - 1
n1 = 3 * n + 1: n2 = 8 * n + 1
sr = Int(Sqr(n1) + 0.5)
If sr * sr = n1 Then
sr = Int(Sqr(n2) + 0.5)
If sr * sr = n2 Then
Text1.Text = Text1.Text & n & crlf
End If
End If
Next rt
Text1.Text = Text1.Text & crlf & " done"
End Sub
Only the number 120 works.
3*120 = 19^2 - 1
8*120 = 31^2 - 1
|
Posted by Charlie
on 2017-01-26 14:38:53 |