Fibonacci numbers can be calculated very efficiently using matrix multiplications.
I hope you can think it/google it now.. that is better than me writing so much again :) -------------------------------------------------- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Fri, Jun 11, 2010 at 8:12 PM, Raj N <rajn...@gmail.com> wrote: > How to print very large Fibonacci numbers eg fib(1000). > My approach: > When any one of fib(i-1) or fib(i-2) has more than 12 or 13 digits, > partition them into groups of 4 digits and put them in a linked list. > fib(i-1) is put in list1, fib(i-2) in list2. Perform the addition of > these long numbers and overwrite in list2. > Now to find next fib list1 is taken as fib(i-2) and list2 as fib(i-1) > and this repeats until we approach the given number and finally the > result is in list2. > As the number of digits goes on increasing, the list is constructed > dynamically. > > If anyone has an efficient approach pls tell me. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.