Biggest Fib

Discussion of challenges you have already solved
Post Reply
quangntenemy
Posts: 8
Joined: Thu Jul 02, 2009 3:41 pm

Biggest Fib

Post by quangntenemy »

Well isn't it the same as Bigger Fib? An estimation is good enough.

Code: Select all

Hugs> (150000000000000 * log ((1 + sqrt 5) / 2) - log (sqrt 5)) / log (exp 1)
72181773758939.7
jonik555
Posts: 43
Joined: Mon Aug 31, 2009 6:18 pm
Location: Prague

Post by jonik555 »

Hmm, I computed BiggerFib directly... (Wolfram Mathematica :) )
There are 10 types of people, those who understand ternary, those who think that this joke is about binary and the others.
nighthalk
Posts: 41
Joined: Fri Jul 31, 2009 8:22 pm

Post by nighthalk »

i wrote a "bigfloat" library using a few bigints so i could take an accurate ln to (in my case) 40 places but it was SLOOOWWW hehe. i didnt optimize it at all so it was inherently transfering back and forth to strings and working in base 10 half the time. if i knew mathmatica had one built in... sigh.. hehe
chephy
Posts: 17
Joined: Sat Oct 16, 2010 4:39 pm

Post by chephy »

I solved Big Fib using the Ruby REPL, Bigger Fib directly with Mathematica (since I couldn't be bothered to think about whether the approximation I had in mind would be precise enough), and Biggest Fib finally using the »intelligent« solution, i.e. the relation of Fibonacci numbers with the golden ratio…
whattheh@ck
Posts: 16
Joined: Wed Jul 16, 2008 2:33 am
Location: here

Post by whattheh@ck »

I just used a simple perl script for bigger fib and biggest fib. It got both solutions almost instantaneously:

Code: Select all

#! /usr/bin/perl -w

$root5 = sqrt(5);
$phi = (1+$root5)/2;
$fib = 150000000000000;
$answer = ((2*$fib)*log($phi))-($fib*log($phi))-(log($root5));
printf "%.1f\n",$answer;
this is technically an approximation but it works just fine on such big numbers :wink:
hack the planet
User avatar
laz0r
Posts: 290
Joined: Thu Feb 04, 2010 4:18 pm
Location: Within the depths of Unix

Post by laz0r »

For values of x greater than about 100, the expanded term -(-(2/(1 + Sqrt[5])))^x in the Fibonacci generator is equal to 0 at this precision. The remaining function simplifies to x * hyerbolic arc-cosecant(2) - (log 5)/2, which is easy to calculate. (Mathematica again :P )
There is no spoon.
Millennium
Posts: 17
Joined: Thu Apr 21, 2011 3:08 am

Post by Millennium »

Same as last time:

150000000000000*log(1.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475408807538689175212663386222353693179318006076672635443)-.5*log(5)

or x*log(phi)-.5*log(5)
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Re: Biggest Fib

Post by AMindForeverVoyaging »

quangntenemy wrote:Well isn't it the same as Bigger Fib?
Yeah, pretty much. What the point of this challenge is after having solved Bigger Fib escapes me.
tripleedged
Posts: 10
Joined: Fri Apr 16, 2010 11:24 pm

Post by tripleedged »

Well, it might happen that wolfram-alpha will solve bigger fib in some years. It certainly takes another while, till this one will be solved...

I had a more complicated approach to this. I first got the log of two large enough (i think it was 1000 and 1001) adjacent fibs, and calculated the difference. Didnt know, that this the same as ln(phi)... But nice to know!

The remaining part was done by the good old windows calculator...
moose
Posts: 67
Joined: Fri Jul 16, 2010 7:32 pm

Post by moose »

I have written this Python-Snippet:

Code: Select all

from decimal import *
from math import log

getcontext().prec = 20

lnOfPhi = Decimal("""1.618033988749894848204586834365638117720309179805762862135
44862270526046281890244970720720418939113748475408807538689175212663386222353693
17931800607667263544333890865959395829056383226613199282902678806752087668925017
11696207032221043216269548626296313614438149758701220340805887954454749246185695
36486444924104432077134494704956584678850987433944221254487706647809158846074998
87124007652170575179788341662562494075890697040002812104276217711177780531531714
10117046665991466979873176135600670874807101317952368942752194843530567830022878
56997829778347845878228911097625003026961561700250464338243776486102838312683303
72429267526311653392473167111211588186385133162038400522216579128667529465490681
13171599343235973494985090409476213222981017261070596116456299098162905552085247
90352406020172799747175342777592778625619432082750513121815628551222480939471234
14517022373580577278616008688382952304592647878017889921990270776903895321968198
61514378031499741106926088674296226757560523172777520353613936210767389376455606
06059216589466759551900400555908950229530942312482355212212415444006470340565734
79766397239494994658457887303962309037503399385621024236902513868041457799569812
24457471780341731264532204163972321340444494873023154176768937521030687378803441
70093954409627955898678723209512426893557309704509595684401755519881921802064052
90551893494759260073485228210108819464454422231889131929468962200230144377026992
30078030852611807545192887705021096842493627135925187607778846658361502389134933
33122310533923213624319263728910670503399282265263556209029798642472759772565508
61548754357482647181414512700060238901620777322449943530889990950168032811219432
04819643876758633147985719113978153978074761507722117508269458639320456520989698
55567814106968372884058746103378105444390943683583581381131168993855576975484149
144534150912954070050194775486163""").ln()
print(150000000000000*lnOfPhi-Decimal("0.5")*Decimal(5).ln()) 
magnus
Posts: 20
Joined: Thu Mar 05, 2009 2:29 pm

Post by magnus »

Did it with bc

w5=sqrt(5)
n=150000000000000
l(1/w5) + n*l( (1+w5) / 2 )

72181773758939.71240570761996346796
Post Reply