Assume that in the 24th month, the sample code is as follows:
Public class woo {
Public static void main (strinargs []) {
system . out . println(fib(24));
}
Dedicated static internal optical fiber (internal n)
if (n == 1 || n == 2) {
Returns1;
} Otherwise {
Return fiber (n-1)+fiber (n-2);
}
}
}
Extended data:
Fibonacci series, also known as the golden section series, was introduced by the mathematician Leonardo Fibonacci taking raising rabbits as an example, so it is also called "rabbit series", which refers to such a series: 1, 1, 2, 3, 5, 8, 65433.
Mathematically, the recursive definition of Fibonacci sequence is as follows: F( 1)= 1, f (2) = 1, f (n) = f (n- 1)+f (n-2) In modern physics and quasicrystals,
References:
Baidu Encyclopedia: Fibonacci Sequence
Baidu Encyclopedia: Recursive Function