Re: How can I get the previous Fibonacci calculated
- To: mathgroup at smc.vnet.net
- Subject: [mg100304] Re: [mg100266] How can I get the previous Fibonacci calculated
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 31 May 2009 06:36:51 -0400 (EDT)
- Reply-to: hanlonr at cox.net
prevFib[x_] := Module[{m, n, x2},
x2 = SetPrecision[x, 100];
If[x > 10^15,
N[x/GoldenRatio],
m = (n /. FindRoot[Fibonacci[n] - x2 == 0, {n, 100},
WorkingPrecision -> 100]) - 1;
If[Abs[m - Round[m]] < 10^-10,
Fibonacci[Round[m]],
N[Fibonacci[m]]]]]
prevFib[13]
8
prevFib[Fibonacci[50]] == Fibonacci[49]
True
prevFib[Fibonacci[10000]] == Fibonacci[9999]
True
prevFib[Fibonacci[20000]] == Fibonacci[19999]
True
prevFib[234.34*^10]
1.4483008492365037*^12
Bob Hanlon
---- ratulloch at gmail.com wrote:
=============
Greetings
How can I get a previous Fibonacci calculated number in a specific
range. I can calculate the previous number of phi see below
phi1 =(1+sqrt(5))/2
13/phi1
I tested it with 13 and got 8.034441857 .....so that works
but how can I get only the previous numbers of Fibonacci in a
specified range from 20 to 20000 if I input a large number like
234.34e10
tia sal2