Find all ways of expressing 1 as the sum of
nine distinct odd Egyptian Fractions.
I.e. reciprocals of odd whole numbers.
The program finds
1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/21 + 1/135 + 1/10395
1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/21 + 1/165 + 1/693
1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/21 + 1/231 + 1/315
1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/33 + 1/45 + 1/385
1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/35 + 1/45 + 1/231
The whole output was
2.828968253968251
+ 1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/21 + 1/135 + 1/10395
1
+ 1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/21 + 1/165 + 1/693
1
+ 1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/21 + 1/231 + 1/315
1
+ 1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/33 + 1/45 + 1/385
1
+ 1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/35 + 1/45 + 1/231
19999
done
The first number printed was just a verification that the reference table was constructed correctly, by checking its highest entry. The table was used in the program to see if there were sufficiently large numbers in the next few to get to at least 1 as a total. Combined with stopping the recursion if the total got to over 1 or the number of terms would get to more than 9, this speeded up processing.
The number 19999 at the end indicated we reached the limit of the entries we were trying for. If it had stopped short of that value, we could say we reached a natural limit and that there were no further answers. But that's not the case so we haven't show that we have all the answers. This was probably to be expected as the series diverges, so this method would never show a lack of possibility for further solutions.
Discussions while in the queue, with reference to outside web sites, indicate these are the only five possibilities, but this program does not prove that. The very determination to go to 20,000 was based on a knowledge of the answer, and so is really a cheat.
DefDbl AZ
Dim crlf$, h(36), tot, sumNext(1 To 9, 20000), highI
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For i = 20000 To 1 Step 1
sumNext(1, i) = 1 / i
For n = 2 To 9
For j = i To i + n  1
If j <= 20000 Then
sumNext(n, i) = sumNext(n, i) + sumNext(1, j)
End If
Next
Next
Next
Text1.Text = Text1.Text & sumNext(9, 1)
For st = 1 To 101 Step 2
h(1) = st: tot = 1 / st
addOn 2
Next
Text1.Text = Text1.Text & crlf & highI & crlf
Text1.Text = Text1.Text & crlf & " done"
End Sub
Sub addOn(wh)
DoEvents
st = h(wh  1) + 2
For i = st To 20000 Step 2
DoEvents
h(wh) = i
savetot = tot
tot = tot + sumNext(1, i)
If Abs(tot  1) < 0.0000000000001 And wh = 9 Then
Text1.Text = Text1.Text & tot & crlf & " "
For j = 1 To wh
Text1.Text = Text1.Text & " + 1/" & h(j)
Next
Text1.Text = Text1.Text & crlf
End If
If i < 20000 And tot < 1.0001 And wh < 9 Then
If tot + sumNext(9  wh, i + 1) + 0.000000001 >= 1 Then
If i > highI Then highI = i
addOn wh + 1
End If
End If
tot = savetot
Next
End Sub

Posted by Charlie
on 20170621 16:02:27 