Each of A, B and C is a positive integer in arithmetic sequence, with A < B < C such that the last four digits in the base ten expansion of A*B*C is 2016.
Determine the three smallest values of A+B+C
The three smallest values are 96, 456 and 468.
Those with A + B + C under 1000:
A+B+C A*B*C A B C
96 2016 1 32 63
456 3482016 138 152 166
468 3032016 86 156 226
486 4142016 136 162 188
543 1002016 16 181 346
543 4622016 96 181 266
546 6022016 176 182 188
693 632016 6 231 456
693 5252016 56 231 406
693 12182016 206 231 256
696 2642016 26 232 438
756 11342016 116 252 388
816 16892016 163 272 381
831 15902016 138 277 416
843 19652016 186 281 376
876 17972016 138 292 446
918 28622016 296 306 316
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For b = 10 To 334
For a = 1 To b - 1
c = 2 * b - a
prod = a * b * c
q = Int(prod / 10000)
r = prod - q * 10000
If r = 2016 Then
Text1.Text = Text1.Text & mform(a + b + c, "#########")
Text1.Text = Text1.Text & mform(a * b * c, "#############")
Text1.Text = Text1.Text & mform(a, "#####")
Text1.Text = Text1.Text & mform(b, "#####")
Text1.Text = Text1.Text & mform(c, "#####") & crlf
End If
DoEvents
Next
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 2016-10-11 09:52:41 |