Article View: comp.lang.pascal.borland
Article #330Re: fibonacci programme
From: elhadzil
Date: Mon, 19 Apr 1999 00:00
Date: Mon, 19 Apr 1999 00:00
37 lines
2168 bytes
2168 bytes
Mr Robert AH Prins Please could you tell me how can I put these two sentences r5 = sqrt(5) fib(n) = (((1 + r5) ** n - ((1 - r5)) ** n)) / 2 ** n / r5 in the procedure of my programme? Robert AH Prins wrote: > In article <371B0391.E3122AD7@central.ntua.gr>, > elhadzil@central.ntua.gr wrote: > > do you know how can I create non-recursive programme in pascal that will > > be able to estimate every term of the Fibonacci sequence? > > There is a closed form available to give the mathematical exact value, the one > below! It's based on the fact that > > lim fib(n+1)/fib(n) = (sqrt(5) + 1) / 2 (aka the golden ratio) > n->oo > > r5 = sqrt(5) > fib(n) = (((1 + r5) ** n - ((1 - r5)) ** n)) / 2 ** n / r5 > > A quick test in Rexx (which, through it's "numeric digits n" feature, offers > precision only limited to the amount of storage you throw at it) showed that > the above formula is correct, well at least up to n = 1000. FYI, fib(1000) = > > 434665576869374564356885276750406258025646605173717804024817 > 290895365554179490518904038798400792551692959225930803226347 > 752096896232398733224711616429964409065331879382989696499285 > 16003704476137795166849228875 > > Robert > -- > Robert AH Prins > prinsra@williscorroon.com > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Technical Details
Message-ID:
<371B5271.B8EED898@central.ntua.gr>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<371B0391.E3122AD7@central.ntua.gr> <7ffeoa$avs$1@nnrp1.dejanews.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111659,97274d7edc98e09c X-Google-Attributes: gid111659,public X-Google-Thread: 108ebd,b2211ec9fb6b496 X-Google-Attributes: gid108ebd,public From: elhadzil@central.ntua.gr Subject: Re: fibonacci programme Date: 1999/04/19 Message-ID: <371B5271.B8EED898@central.ntua.gr> X-Deja-AN: 468341380 Content-Transfer-Encoding: 7bit References: <371B0391.E3122AD7@central.ntua.gr> <7ffeoa$avs$1@nnrp1.dejanews.com> To: Robert AH Prins <prinsra@williscorroon.com> X-Accept-Language: en,el Content-Type: text/plain; charset=iso-8859-7 Organization: National Technical University of Athens, Greece Mime-Version: 1.0 Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal