The four smallest values of A + B are 2017, 2407, 2815 and 4465, from:
ordinal
A B A+B tri sq
2016 1 2017 63 1
2211 196 2407 66 14
2415 400 2815 69 20
3240 1225 4465 80 35
5151 3136 8287 101 56
8256 6241 14497 128 79
10296 8281 18577 143 91
17391 15376 32767 186 124
18915 16900 35815 194 130
32640 30625 63265 255 175
41616 39601 81217 288 199
72771 70756 143527 381 266
139656 137641 277297 528 371
246051 244036 490087 701 494
315615 313600 629215 794 560
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For addend = 1 To 1000
DoEvents
tri = tri + addend
If tri >= 2015 Then
sq = tri - 2015
sr = Int(Sqr(sq) + 0.5)
If sr * sr = sq Then
Text1.Text = Text1.Text & mform(tri, "######0") & mform(sq, "######0") & " " & mform(tri + sq, "######0") & mform(addend, "######0") & mform(sr, "####0") & crlf
End If
End If
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
|
Posted by Charlie
on 2015-10-13 15:34:15 |