bigger fib

User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

you're nearly there tripleedge and you may not need any rearranging to get the answer
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

CodeX wrote:and you may not need any rearranging to get the answer
(Note: post edited)

Well, I have solved it now, but I very much had to rearrange the equation of the closed-form expression to get there.
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

The method without rearranging has quite arbitrary steps, and the precision is very good :P
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

But who wants a solution that takes a long time to compute ;)
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

it took a fraction of a second for me, could even do it online :P
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

Well, Wolfram Alpha says "Computation timed out" when entering log(Fibonacci(150000000)) ...
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

I managed to do it with Wolfram Alpha using using only 3 more characters than that, I guess it takes up a load of time trying to do fancy stuff to the value instead of spitting out a plain old number and so times out before getting there unless it's prompted to do so first. Putting that into Mathematica does take a long time though (aborted after a few seconds) but it works nearly instantly when given the closed form so I guess it uses a series function :?
moose
Posts: 67
Joined: Fri Jul 16, 2010 7:32 pm

Post by moose »

I'm trying to solve this with Python.

Could you please tell me if natLog( Fib(1,500,000) ) = 721816.933? (the sequence has 313,482 digits!)
(I know that the challenge asks for 150,000,000, but I want to take a "small" example to test my programms.)

I used psyco to speed python up. It got about two times faster.

Algorithm #1:
  • time for natLog( Fib(1,500,000) ): 1min 19s
  • time for natLog( Fib(15,000,000) ): 2h 54 min =>
Algorithm #2:
  • time for natLog( Fib(1,500,000) ): 1min 53s
  • time for natLog( Fib(15,000,000) ):=>as it seems to be slower than#2, I won't try this
Algorithm #3:
  • time for natLog( Fib(1,500,000) ): 2min 12s
  • time for natLog( Fib(15,000,000) ):=>also too slow
Hmm ... I guess I can't improve the algorithm that much ...
Last edited by moose on Sat Jul 16, 2011 9:39 pm, edited 1 time in total.
User avatar
laz0r
Posts: 290
Joined: Thu Feb 04, 2010 4:18 pm
Location: Within the depths of Unix

Post by laz0r »

Ln(Fib(1500000)) = 721816.93287044895420, so you're nearly right...
There is no spoon.
tripleedged
Posts: 10
Joined: Fri Apr 16, 2010 11:24 pm

Post by tripleedged »

Actually, he is not nearly right, but completely right, since the answer should be rounded to 3 decimals. :-)

In the meantime I have solved this too... Found quite an easy way to conquer it. Was even solving biggest fib in less than 5 minutes, following the same plan...
destiny
Posts: 25
Joined: Thu Jul 03, 2014 4:08 pm
Location: UK

Post by destiny »

Nice challenge. My first program couldn't handle the massive number, so after searching for a long time I found something amazing that can find fib in 8 seconds! Calculating the log took just as long because I just didn't know how for such a big number until I found a nice article that explained how to calculate an approximate value of huge numbers.

It would be interesting to see how to solve this using wolfram alpha too!
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

Yes, it helps to know something from linear algebra.
Matrix multiplication is good close form.
Associativity says you can replace multiplication by exponentation, which can be speeded up by associativity again reusing the same subresults (powers of 2...).
Eigen values gave nice base for another close form, but as they contain square roots, this close form is impractical for exact computation, but is very good for approximations, especially when only logarithm of the result is needed.

[edit]
After reading other posts, I think this could stay here as a hint ... .
And one more hint ... of course when computing approximations, one should do some "roundings" to simplify. It helps to keep in mind which order of magnitude the "rounding" affects.
[/edit]
User avatar
Grusewolf
Posts: 16
Joined: Sun May 29, 2011 7:58 pm
Location: Munich

Post by Grusewolf »

I spend hours to check my solution until I saw, my program printed a 'comma' instead of a decimal point. (OK, I am a german)
This was not accepted as solution. After changing this, I recognized, my result was right.
Post Reply