### Zadanie

*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.*

### Ciąg Fibonaciego

In mathematics, the

Fibonacci numbersare the numbers in the following integer sequence, called theFibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones:^{[1]}^{[2]}

- 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 , …
^{[3]}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

Fof Fibonacci numbers is defined by the recurrence relation_{n}

with seed values

^{[1]}^{[2]}

or

^{[5]}

The Fibonacci sequence is named after Italian mathematician Leonardo of Pisa, known as Fibonacci. His 1202 book

Liber Abaciintroduced the sequence to Western European mathematics,^{[6]}although the sequence had been described earlier as Virahanka numbers in Indian mathematics.^{[7]}^{[8]}^{[9]}The sequence described inLiber Abacibegan withF_{1}= 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,

^{[10]}such as branching in trees, phyllotaxis (the arrangement of leaves on a stem), the fruit sprouts of a pineapple,^{[11]}the flowering of an artichoke, an uncurling fern and the arrangement of a pine cone‘s bracts.^{[12]}— Source: https://en.wikipedia.org/wiki/Fibonacci_number

### Closed form

Fib(n) = | Phi^{n} − (−Phi)^{−n} |
= | Phi^{n} − ( −phi)^{n} |

√5 | √5 |

### Java program and others interesting links

- http://web.cerritos.edu/jwilson/SitePages/java_language_resources/Java_printf_method_quick_reference.pdf
- http://crunchify.com/write-java-program-to-print-fibonacci-series-upto-n-number/ – source java
- https://oeis.org/A000045 – Online Wiki Integers Sequences (!)
- https://en.wikibooks.org/wiki/Java_Programming/Mathematical_functions

### Sources