This is a way to print the continued fraction of N over M:
\ \ Print out the continued fraction of N over M.
: .CF BEGIN SWAP OVER /MOD . DUP WHILE REPEAT 2DROP ;
as in
314159 100000 .CF
3 7 15 ....
which means that PI is approximately 3 1/7
144 89 .CF
1 1 1 1 1 1 1 1 1 2
This shows an interesting property of the Fibonacci numbers 144 and 89:
their quotient shows up as all ones. (A last 2 is equivalent to 1 1).
Now I am interested in what I call the Fibonacci fraction of a number.
(It started as an idea that this may help in factoring the number,
but the following has become a challenge in its own right.)
Definition: the Fibonacci fraction of N is the rational number N/F
where the continued fraction expansion of N/F starts with a maximal
number of ones.
The problem is to find F given N; so much clear that N/F approximates
the golden ratio, or the quotient of two consecutive Fibonacci
numbers.
If something thinks this an interesting problem, and help me
find a way to calculate it efficiently and/or elegantly, I would
be much obliged.
(This is not a homework problem, so there may not be a reasonable
solution!)
Groetjes Albert
--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@[EMAIL PROTECTED]
&=n http://home.hccnet.nl/a.w.m.van.der.horst