<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face="Courier New" size=2>"Alan Gauld" <</FONT><A
href="mailto:alan.gauld@btinternet.com"><FONT face="Courier New"
size=2>alan.gauld@btinternet.com</FONT></A><FONT face="Courier New" size=2>>
wrote</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>> were infinite using floats! So you
need to calculate the<BR>> total as you go without saving the values<BR>>
<BR></FONT></DIV>
<DIV><FONT face="Courier New" size=2>I got curious so wrote the following
function:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>>>> def
fibtot(N):<BR>... f0,f1,tot = 0,1,1<BR>... for n in
range(N):<BR>... f = f0 +
f1<BR>... f0,f1 = f1,f<BR>... if
n % 2 == 0: tot += f<BR>... return tot</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>and here are the results...</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>>>>
len(str(fibtot(10000)))<BR>2090<BR>>>>
len(str(fibtot(100000)))<BR>20899<BR>>>>
len(str(fibtot(200000)))<BR>41798<BR>>>>
len(str(fibtot(400000)))<BR>83595<BR>>>>
len(str(fibtot(500000)))<BR>104494<BR>>>>
len(str(fibtot(600000)))<BR>125393<BR>>>>
len(str(fibtot(800000)))<BR>167190<BR>>>>
len(str(fibtot(1000000)))<BR>208988<BR>>>></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>So the final total contains nearly 209
thousand digits!</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Thats a very, very big number... and it
took 5 minutes </FONT></DIV>
<DIV><FONT face="Courier New" size=2>to compute on my PC (Dual core 2.8GHz with
2G RAM)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Now I really must go to bed :-)</DIV>
<DIV><BR>-- <BR>Alan Gauld<BR>Author of the Learn to Program web site<BR><A
href="http://www.freenetpages.co.uk/hp/alan.gauld">http://www.freenetpages.co.uk/hp/alan.gauld</A></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV></BODY></HTML>