Each of A and B (with A ≤ B) is a divisor of 2016.
For how many pairs (A, B) do A2 + B2 equal a perfect square?
The 24 sets of A, B and C where A^2 + B^2 = C^2:
3 4 5
6 8 10
7 24 25
9 12 15
12 16 20
14 48 50
16 63 65
18 24 30
21 28 35
21 72 75
24 32 40
28 96 100
32 126 130
36 48 60
42 56 70
42 144 150
63 84 105
72 96 120
84 112 140
84 288 300
126 168 210
168 224 280
252 336 420
504 672 840
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 1 To 2016
If 2016 Mod a = 0 Then
For b = a To 2016
If 2016 Mod b = 0 Then
c2 = a * a + b * b
c = Int(Sqr(c2) + 0.5)
If c * c = c2 Then
Text1.Text = Text1.Text & a & Str(b) & Str(c) & crlf
ct = ct + 1
End If
End If
Next b
End If
Next a
Text1.Text = Text1.Text & ct & crlf & " done"
End Sub
|
Posted by Charlie
on 2015-06-12 15:23:04 |