A rather crude solution after a lot of maths(All d maths dat I know) I came up with a crude formula. If the given number is N, x=log (base phi) N whre phi is the golden ratio n=ceil(x)+1 calculate nth fibonacci by matrix expo.(You automatically get f(n-1)) check which one is closer.That should be the answer.
Points of possible failiure in this algo: 1.Precision problem. 2.My crude maths. On Sun, Nov 20, 2011 at 6:50 PM, saurabh singh <[email protected]> wrote: > This helps in only finding the nth fibonacci not the fibonacci *closest > to n.*Though i am getting an intuition the same can be done in > o(logn).Can you explain the complete answer? > > > On Sun, Nov 20, 2011 at 5:09 PM, amrit harry <[email protected]>wrote: > >> ThnQ... >> >> >> On Sun, Nov 20, 2011 at 3:32 PM, Amol Sharma <[email protected]>wrote: >> >>> http://www.geeksforgeeks.org/archives/10120 have a look at method 5 in >>> this article...they have explained quite well >>> -- >>> >>> >>> Amol Sharma >>> Third Year Student >>> Computer Science and Engineering >>> MNNIT Allahabad >>> <http://gplus.to/amolsharma99> >>> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> >>> >>> >>> >>> >>> >>> On Sun, Nov 20, 2011 at 3:29 PM, amrit harry <[email protected]>wrote: >>> >>>> nyone pls xpalin the algo.... >>>> >>>> >>>> On Sun, Nov 20, 2011 at 2:39 PM, kartik sachan <[email protected] >>>> > wrote: >>>> >>>>> yup using matrix method we can solve it in O(log(n))..... >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> >>>> >>>> -- >>>> AMRIT >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> AMRIT >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > > > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
