Difficulty question, help!

2009-10-12 6:05 am
Consider the following algorithm for writing a fraction
m/n in this form (1 <= m < n):
write the fraction 1/a where a = the smallest integer not less than n/m
, calculate the fraction
m/n - 1/a and if it is nonzero repeat the same step.
Then, fractions can be written as sums of fractions with numerator 1.
e.g. 4/9 = 1/3+1/9

To prove the algorithm always finishes in a finite number of steps using induction.

回答 (1)

2009-10-13 7:03 am
✔ 最佳答案
Consider the first iteration.
The fraction is m/n where 1 <= m < n
Let the quotient and remainder of n/m be q and r respectively
Therefore n = mq + r OR n/m = q + r/m and 0 <= r < m
Since a is the smallest integer not less than n/m, if r = 0, then a = n/m and the process is done (in a single iteration). In general, r is not zero, so a = q + 1 and 0 < r < m
The difference m/n – 1/a = (am – n) / an.
I denote this fraction as m(1)/n(1): the index 1 means the first iteration.
n(1) = an and m(1) = am – n
= am – (mq + r)
= am – m(a – 1) – r
= m – r
Since r > 0, m – r < m
Therefore m(1) < m
Consider the result after the k steps, if the process still needs to continue.
The difference obtained from the k-th step is m(k)/n(k).
Following the same logic, n(k) = m(k)q(k) + r(k), and a(k) = q(k) + 1 with 0 < r(k) < m(k) [if r(k) = 0 then the process will complete after k finite steps]
The difference obtained after the k+1 step is m(k)/n(k) – 1/a(k) = [m(k) – r(k)] / [a(k)n(k)]
So in general m(k+1) < m(k)
It follows that m > m(1) > m(2) … > m(k) > m(k+1) > …
Since m is finite, after at most m steps the numerator will reduce to zero and the process is complete. Hence the number of iterations is always finite for any finite value of m.

2009-10-13 06:49:14 補充:
m, n and a are all integers, and 1 <= m < n. So n cannot be zero.
m > m(1) > m(2) > ...
Let says each time reduce by 1, then m > m-1 > m-2... at most m steps reduce to zero. Is it obvious? You can use a real example to test out...

2009-10-13 21:05:08 補充:
給你一些例子:
http://img382.imageshack.us/img382/1164/13oct.png


收錄日期: 2021-04-11 01:07:54
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20091011000051KK02175

檢視 Wayback Machine 備份