Bigger Fib
Bigger Fib
That was fun.
While solving "Big Fib" with bc driven by a perl-script and using the dijkstra-simplification, I realized that getting the solution for this challenge would take more time and cycles than I want to spent on it.
So, I changed to C with GMP and was really thrilled by the speed of GMP in computing fib members (damn, should have known that before ) . But GMP lacks ln() so I spent some extra time to bring in MPFR.
.done! (phewww)
While solving "Big Fib" with bc driven by a perl-script and using the dijkstra-simplification, I realized that getting the solution for this challenge would take more time and cycles than I want to spent on it.
So, I changed to C with GMP and was really thrilled by the speed of GMP in computing fib members (damn, should have known that before ) . But GMP lacks ln() so I spent some extra time to bring in MPFR.
.done! (phewww)
Phew, finally solved that one... after I got the BigFib I really was shocked by the BiggerFib challenge, a short attempt to calculate this number (w/o thinking about the ln-part too much) led me to the point that this is simply senseless...
It was not until half an hour ago that I read about ways to calculate big f(n) and to recap the laws of logarithmics.
Now on to the biggest fib
EDIT: OK, biggest is not really harder than bigger...
It was not until half an hour ago that I read about ways to calculate big f(n) and to recap the laws of logarithmics.
Now on to the biggest fib
EDIT: OK, biggest is not really harder than bigger...
-
- Posts: 8
- Joined: Thu Jul 02, 2009 3:41 pm
-
- Posts: 17
- Joined: Thu Apr 21, 2011 3:08 am
Wolfram|Alpha did it.
Has anyone solved it with Python? Could you please post your solution? Or any C++ approach? (I would like to learn C++ and I appreciate reading examples)
Has anyone solved it with Python? Could you please post your solution? Or any C++ approach? (I would like to learn C++ and I appreciate reading examples)
I think most of us probably used the formula for the nth Fibonacci number, ending up with:moose wrote:Wolfram|Alpha did it.
Has anyone solved it with Python? Could you please post your solution? Or any C++ approach? (I would like to learn C++ and I appreciate reading examples)
-(Log[5]/2) + Log[-(2/(1 + Sqrt[5]))^n + (1/2 (1 + Sqrt[5]))^n]
(WolframAlpha will show this in a nice format).
Then noting that the -(2/(1+Sqrt[5]))^n term will become very close to 0 as n increases, so we end up with:
-(Log[5]/2) + n Log[(1/2 (1 + Sqrt[5]))]
which is very easy to find.
There is no spoon.