Utwórz rekurencyjna metode obliczajaca ciag Fibonacciego, zdefiniowany dla elementu fibonacci(n) jako sume fibonacci(n-1) + fibonacci(n-2) przy załozeniu, ze fibonacci(1) i fibonacci(2) maja odpowiednio wartosci 1 i 2.
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones:
- 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144 , …
Often, especially in modern usage, the sequence is extended by one more initial term:
- 0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144 , …
By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation
The Fibonacci sequence is named after Italian mathematician Leonardo of Pisa, known as Fibonacci. His 1202 book Liber Abaci introduced the sequence to Western European mathematics, although the sequence had been described earlier as Virahanka numbers in Indian mathematics. The sequence described in Liber Abaci began with F1 = 1.
Fibonacci numbers are closely related to Lucas numbers in that they form a complementary pair of Lucas sequences and . They are intimately connected with the golden ratio; for example, the closest rational approximations to the ratio are 2/1, 3/2, 5/3, 8/5, … .
Fibonacci numbers appear unexpectedly often in mathematics, so much so that there is an entire journal dedicated to their study, the Fibonacci Quarterly. Applications of Fibonacci numbers include computer algorithms such as the Fibonacci search technique and the Fibonacci heap data structure, and graphs called Fibonacci cubes used for interconnecting parallel and distributed systems. They also appear in biological settings, such as branching in trees, phyllotaxis (the arrangement of leaves on a stem), the fruit sprouts of a pineapple, the flowering of an artichoke, an uncurling fern and the arrangement of a pine cone‘s bracts.
— Source: https://en.wikipedia.org/wiki/Fibonacci_number
|Fib(n) =||Phin − (−Phi)−n||=||Phin − ( −phi)n|
Java program and others interesting links
- http://crunchify.com/write-java-program-to-print-fibonacci-series-upto-n-number/ – source java
- https://oeis.org/A000045 – Online Wiki Integers Sequences (!)