Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,8 +1,17 @@
function fib(n: integer): integer;
begin
if (n = 0) or (n = 1)
then
fib := n
else
fib := fib(n-1) + fib(n-2)
end;
function fib(n: integer):longInt;
const
Sqrt5 = sqrt(5.0);
C1 = ln((Sqrt5+1.0)*0.5);//ln( 1.618..)
//C2 = ln((1.0-Sqrt5)*0.5);//ln(-0.618 )) tsetsetse
C2 = ln((Sqrt5-1.0)*0.5);//ln(+0.618 ))
begin
IF n>0 then
begin
IF odd(n) then
fib := round((exp(C1*n) + exp(C2*n) )/Sqrt5)
else
fib := round((exp(C1*n) - exp(C2*n) )/Sqrt5)
end
else
Fibdirekt := 0
end;