Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Fibonacci-sequence/Pascal/fibonacci-sequence-1.pas
Normal file
17
Task/Fibonacci-sequence/Pascal/fibonacci-sequence-1.pas
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue