How many integer solutions has the following equation:
sqrt(x)+sqrt(y)=sqrt(3888)?
Assume x>y.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
For x = 0 To 3888
For y = 0 To x
summ = Sqr(x) + Sqr(y)
diff = Abs(Sqr(3888) - summ)
If diff < 0.0000000001 Then
Text1.Text = Text1.Text & x & Str(y) & crlf
ct = ct + 1
End If
Next
Next
Text1.Text = Text1.Text & ct & " done"
End Sub
lists integral solutions to sqrt(x)+sqrt(y)=sqrt(3888):
972 972
1083 867
1200 768
1323 675
1452 588
1587 507
1728 432
1875 363
2028 300
2187 243
2352 192
2523 147
2700 108
2883 75
3072 48
3267 27
3468 12
3675 3
3888 0
There are 19 solutions, but the first one listed has x=y rather than x>y, so the answer to the puzzle is 18.
|
Posted by Charlie
on 2019-04-09 10:55:30 |