All digits of Fibonacci number using implicit calculation method
- To: mathgroup at smc.vnet.net
- Subject: [mg16736] All digits of Fibonacci number using implicit calculation method
- From: Alex Vinokur <alexander.vinokur at telrad.co.il>
- Date: Wed, 24 Mar 1999 02:23:50 -0500
- Sender: owner-wri-mathgroup at wolfram.com
[Please keep messages to the newsgroup and mailing list regarding this problem related to Mathematica solutions. Other comments to the authors via email. - moderator] Hi, Here's is function written on C++ language and based on implicit formula of Fibonacci#n calculation. //################################## //######### C++ function ########### //################################## #include <string> #include <math.h> double Fib (int n) { double R5 = sqrt (5); double Phi = (1+R5)/2; double Psi = (1-R5)/2; return ((pow (Phi, n) - pow (Psi, n))/R5); } //################################## Here are the calculation results. //################################## //######### Results ################ //################################## Fib [0] = 0 Fib [1] = 1 Fib [2] = 1 Fib [3] = 2 Fib [4] = 3 Fib [5] = 5 Fib [6] = 8 Fib [7] = 13 Fib [8] = 21 Fib [9] = 34 Fib [10] = 55 [snip] Fib [28] = 317811 Fib [29] = 514229 Fib [30] = 832040 Fib [31] = 1.34627e+06 Fib [32] = 2.17831e+06 Fib [33] = 3.52458e+06 [snip] Fib [1472] = 1.90687e+307 Fib [1473] = 3.08538e+307 Fib [1474] = 4.99225e+307 Fib [1475] = Infinity Fib [1476] = Infinity Fib [1477] = Infinity ... //################################## What do we have to do to get (using this formula) all decimal digits of large Fibonacci number? How do we have to change this algorithm? Thanks in advance, Alex -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own