Then its nth number is twice that of Fibonacci sequence, so its general formula is:
Let the nth number be Fn, then Fn=2/ radical number 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