The infinite continued fraction: x + 1/(y+ 1/(x+ 1/(y + ....))) is denoted by C(x, y).
Determine all possible quadruplet(s)(e, f, g, h) of positive integers that satisfy this equation:
2 1 1
-------- - --------- = ---
C(e, f) C(g, h) 2
where e, f, g and h are distinct.
Using a computer to calculate the function C(x,y) out to 25 repetitions of 'x+1/(y+1/...' found two solutions to the problem.
E F G H
+-+-+-+-+-+-+-+-+
2 | 1 | 4 | 3
3 | 2 | 12 | 5
We can find that any value of E greater than 3 would lead to 2 / C(E,F) being less than 1/2. If E is 1, there's no way for C(E,F) to be greater than 2
and C(G,H) to be less than 2, as that is necessary for 2/C(E,F) - 1/C(G,H) ≤ 1/2 and thus no possible solutions for E = 1.
So, E must be equal to 2 or 3. Solving the equation for C(G,H), we can see that C(G,H) = 2 / C(E,F) - 1 / 2. And since G + 1/(H + .... will always be equal to integer G plus some fractional part, we needn't check more than one value of G for each combination of E and F. Checking all values of F and H from 1 to 150 gets us the two results above.
for E in range(2,4):
for F in range(1,151):
Part_I=Infinitely_Continued(E,F)
G=int(1.0/(2.0/Part_I-0.5))
if G!=0:
for H in range(1,151):
LIST_VALUES=[E,F,G,H]
WORKS=1
for R in LIST_VALUES:
if LIST_VALUES.count(R)>1:
WORKS=0
break
if WORKS:
RESULT=2.0/Part_I-1.0/Infinitely_Continued(G,H)
if abs(RESULT-0.5)<0.000000000000001:
print(E,F,G,H)
In my solution, I assumed that after 25 "layers", rounding may cause some problems with exact values, and took anything that rounded to 0.5 out to 15 decimal places to be a solution. No other values that were checked came any closer to being accurate than rounding to 6 digits, so I feel this was a safe assumption.Edited on December 29, 2009, 4:22 pm
|
Posted by Justin
on 2009-12-29 16:16:00 |