Juggler_IN
Active Member
- Joined
- Nov 19, 2014
- Messages
- 349
- Office Version
- 2003 or older
- Platform
- Windows
I am trying to replicate the Splitting Method for fractions.
Given two integers p, q, the method states that using the identity 1/n = 1/(n+1) + 1/(n(n+1)):
Step 1:Write p/q as the sum of p unit fractions 1/q
Step 2:If there are duplicated fractions 1/a in the expansion (for any integer a), keep one of them, but remove the other duplicated (1/a)’s by applying the splitting relation to them.
Step 3:Repeat Step 2 until an expansion is reached which has no denominator duplicated.
For example, if 3/7 is being decomposed via the Splitting algorithm, it is first decomposed as 1/7 + 1/7 + 1/7. Next, the identity 1/n = 1/(n+1) + 1/(n(n+1)) is applied to each duplicated fraction recursively until a unit fraction expansion is obtained. Namely,
3/7 = 1/7 + 1/7 + 1/7
= 1/7 + (1/8 + 1/56) + (1/8 + 1/56)
= 1/7 + 1/8 + 1/56 + (1/8) + (1/56)
= 1/7 + 1/8 + 1/56 + (1/9 + 1/72) + (1/57 + 1/3192)
And since no repeats,
3/7 = 1/7 + 1/8 + 1/56 + 1/9 + 1/72 + 1/57 + 1/3192: the final answer.
My VBA 2003 code is missing two entries 1/9 and 1/72. Any possible edits?
Given two integers p, q, the method states that using the identity 1/n = 1/(n+1) + 1/(n(n+1)):
Step 1:Write p/q as the sum of p unit fractions 1/q
Step 2:If there are duplicated fractions 1/a in the expansion (for any integer a), keep one of them, but remove the other duplicated (1/a)’s by applying the splitting relation to them.
Step 3:Repeat Step 2 until an expansion is reached which has no denominator duplicated.
For example, if 3/7 is being decomposed via the Splitting algorithm, it is first decomposed as 1/7 + 1/7 + 1/7. Next, the identity 1/n = 1/(n+1) + 1/(n(n+1)) is applied to each duplicated fraction recursively until a unit fraction expansion is obtained. Namely,
3/7 = 1/7 + 1/7 + 1/7
= 1/7 + (1/8 + 1/56) + (1/8 + 1/56)
= 1/7 + 1/8 + 1/56 + (1/8) + (1/56)
= 1/7 + 1/8 + 1/56 + (1/9 + 1/72) + (1/57 + 1/3192)
And since no repeats,
3/7 = 1/7 + 1/8 + 1/56 + 1/9 + 1/72 + 1/57 + 1/3192: the final answer.
My VBA 2003 code is missing two entries 1/9 and 1/72. Any possible edits?
VBA Code:
Sub FTN()
Dim x, y, u(), v(), i, j
x = 3
y = 7
ReDim u(x)
ReDim v(x)
u(1) = x
v(1) = y
Debug.Print 1 & "/" & v(1)
For i = 2 To x
u(i) = (v(i - 1) + 1)
v(i) = v(i - 1) * (v(i - 1) + 1)
Debug.Print 1 & "/" & u(i)
Debug.Print 1 & "/" & v(i)
Next i
End Sub