FIBONACCI SERIES IN JAVA

The Fibonacci series is a sequence of numbers in which each number, starting from the third one, is the sum of the two preceding numbers. It is named after the Italian mathematician Leonardo Fibonacci, who introduced it to the Western world in his book “Liber Abaci” in the early 13th century.

The Fibonacci sequence typically starts with 0 and 1, so the first few numbers in the series are 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on. Mathematically, the sequence can be defined by the recursive formula:

F(n) = F(n-1) + F(n-2)

where F(n) represents the nth Fibonacci number, F(n-1) is the (n-1)th Fibonacci number, and F(n-2) is the (n-2)th Fibonacci number.

The Fibonacci sequence has numerous fascinating properties and is found in various natural phenomena, such as the branching patterns of trees, the arrangement of leaves on stems, the spirals of seashells, and even in the growth patterns of populations. It has significant applications in mathematics, computer science, and other fields.

The ratio between consecutive Fibonacci numbers approaches the “Golden Ratio” (approximately 1.618), which is considered aesthetically pleasing and has been utilized in art, architecture, and design for its perceived harmony and balance. The Fibonacci series continues infinitely, with each number generated by adding the two preceding numbers, creating an ever-expanding sequence.

public class ex_fibonacci {
    static void fibonacci(int n) {
        int second_last = -1;
        int last = 1;
        for (int i = 1; i <= n; i++) {
            int val = second_last + last;
            System.out.print(val + " ");
            second_last = last;
            last = val;
        }
        System.out.println("");
    }

    public static void main(String[] args) {
        fibonacci(11);
    }
}

Leave a Comment

Your email address will not be published. Required fields are marked *