fraction between 2 number, minimum denominator
|
09-16-2023, 07:47 PM
Post: #1
|
|||
|
|||
fraction between 2 number, minimum denominator
From thread Companion program for Joe Horn’s continued fractions article.
Python code, translated for HP Prime (if micro-Python available, that should work too) Code: d_convergent(a,b, d1,d2) Once minimum denominator are picked, program pick minimum numerator too. Code assumed number are *exact* fractions, not float. Cas> frac_between(18/10,19/10) --> 9/5 Cas> frac_between(18/10,18/10) --> 9/5 Cas> frac_between(18/10,17/10) --> 7/4 Cas> frac_between(18/10,16/10) --> 5/3 Cas> frac_between(18/10,15/10) --> 3/2 Cas> frac_between(18/10,14/10) --> 3/2 Cas> frac_between(999999999977/10^12,999999999978/10^12) --> 43478260869/43478260870 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
fraction between 2 number, minimum denominator - Albert Chan - 09-16-2023 07:47 PM
RE: fraction between 2 number, minimum denominator - Albert Chan - 09-18-2023, 11:28 PM
RE: fraction between 2 number, minimum denominator - Albert Chan - 09-19-2023, 12:19 PM
|
User(s) browsing this thread: 1 Guest(s)