Determine the total number of ways in which 363 can be written as a sum of three distinct positive integers which are in
harmonic sequence.
Prove that there are no others.
1/c - 1/b = 1/b - 1/a
ab - ac = ac - bc
ab + bc = 2ac
b(a + c) = 2ac
b = 2ac/(a+c)
Let a be the smallest and c the largest:
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
n = 363
For a = 1 To n / 3
For c = a + 1 To n - a
b = 2 * a * c / (a + c)
If b = Int(b) Then
If a + b + c = n Then
Text1.Text = Text1.Text & Str(a) & Str(b) & Str(c) & crlf
End If
End If
Next
Next a
End Sub
finds
13 25 325
55 88 220
66 99 198
108 120 135
|
Posted by Charlie
on 2014-05-22 16:34:42 |