Current location - Training Enrollment Network - Mathematics courses - How to express Fibonacci sequence with formula?
How to express Fibonacci sequence with formula?
Fibonacci series The inventor of Fibonacci series is Italian mathematician Leonardo Fibonacci, who was born in 1 170 and died in 1240. The native place is probably Pisa). He is called "Leonardo of Pisa". From 65438 to 0202, he wrote the book Liber Abaci. He was the first European to study the mathematical theories of India and Arabia. His father was hired as a diplomatic consul by a business group in Pisa and was stationed in today's Algeria, so Da Vinci was able to study mathematics under the guidance of an Arab teacher. He also studied mathematics in Egypt, Syria, Greece, Sicily and Provence.

Fibonacci series refers to such a series: 1, 1, 2, 3, 5, 8, 13, 2 1 ...

This series begins with the third item, each item is equal to the sum of the first two items. The general formula is: (1/√ 5) * * y: = x+x * y;

temp[2 1]:= x[2 1]* y[ 1, 1]+x * y[2 1];

temp:=x[2, 1]* y+x * y;

Exit (temporary);

End;

Function getcc(n: integer): matrix;

defined variable

Temp: matrix;

T: integer;

begin

If n= 1, exit (c);

t:= n div 2;

temp:= getcc(t);

temp:=multiply(temp,temp);

If it is odd (n), exit (multiply by (temp, c)).

Otherwise exit (temp);

End;

Process initialization;

begin

readln(n);

c[ 1, 1]:= 1;

c:= 1;

c[2, 1]:= 1;

c:= 0;

If n= 1

begin

writeln( 1);

Stop;

End;

If n=2, then

begin

writeln( 1);

Stop;

End;

cc:= getcc(n-2);

End;

Procedural work;

begin

writeln(cc[ 1, 1]+cc);

End;

begin

init

Work;

End.

Another solution of sequence value

f(n)=[(sqrt(5)+ 1)/2)^ n]

Where [x] represents the integer closest to x.

The first few items of the sequence

1 1

2 2

3 3

4 5

5 8

6 13

7 2 1

8 34

9 55

10 89

1 1 144

12 233

13 377

14 6 10

15 987

16 1597

17 2584

18 4 18 1

19 6765

20 10946