What is the Fibonacci Series with explanation and program YASH PAL, 14 January 202128 May 2024 Fibonacci series is a series in which we have given the first two numbers and the next number sequence can be found using the sum of the two preceding ones. it is denoted by Fn. and the number in the Fibonacci series is called Fibonacci numbers. This series is named for Leonardo Pisano an Italian mathematician. In Mathematics Fibonacci sequence is defined as a1 = 0, a2 = 1 and an = (an-1) + (an-2) where (n > 2) so the Fibonacci sequence is a series of numbers Fibonacci series Here the 3rd number is found by adding the two numbers before it (0 + 1). the 4th number is found by adding the two numbers before it (1 + 2) and soon. Note – In modern mathematics, we can’t include 0. Fibonacci was not the first to know about the sequence, it was known in India hundreds of years before it appears in the Sanskrit prosody. Use of the Fibonacci series in Real life When we make squares with those widths, we get a nice spiral. and this spiral is found in nature too. It is also used in coding and programming languages to solve practical problems. one of the main applications of Fibonacci numbers is in the area of stock market analysis. we use it to estimate the price of a particular stock. It is used to calculate the population of bees or rabbits. It is also used to estimate the complexity of a task. It is also used in mathematics to find solutions like Pascal’s triangle and Pythagorean triples. One of the major facts is that when we calculate the ratio of two consecutive numbers then it is very close to the Golden Ratio. the bigger the pair of Fibonacci numbers the close the approximations to the golden ratio. First 10 Fibonacci numbers let’s say a1 = a2 = 1 and to find the first 10 numbers we are going to use the formula (an-1) + (an-2) where (n > 2). always remember we need to have the first two numbers if we want to find the other sequence of the Fibonacci series. a1 = 1 = a2 a3 = 1 + 1 = 2 a4 = 1 + 2 = 3 a5 = 2 + 3 = 5 a6 = 3 + 5 = 8 a7 = 5 + 8 = 13 a8 = 8 + 13 = 21 a9 = 13 + 21 = 34 a10 = 21 + 34 = 55 Program in C Programming #include <stdio.h> int main() { int a1 = 1; int a2 = 1; int s, next; int i = 1; printf("Enter length of fibonacci series: "); scanf("%d", &s); printf("%d\n%d \n", a1, a2); for(i;i<s;i++){ next = a1 + a2; printf("%d \n", next); a1 = a2; a2 = next; next = 0; } return 0; } Program in C++ Programming #include <stdio.h> int main() { int a1 = 1; int a2 = 1; int s, next; int i = 1; printf("Enter length of fibonacci series: "); scanf("%d", &s); printf("%d\n%d \n", a1, a2); for(i;i<s;i++){ next = a1 + a2; printf("%d \n", next); a1 = a2; a2 = next; next = 0; } return 0; } Program in Java programming import java.util.*; public class random { public static void main(String[] args) { int i = 1, t1 = 0, t2 = 1; System.out.print("Enter length of Series: "); Scanner sc=new Scanner(System.in); int n = sc.nextInt(); System.out.print("First " + n + " terms: "); while (i <= n) { System.out.print(t1 + "\n "); int sum = t1 + t2; t1 = t2; t2 = sum; i++; } } } Program in Python Programming n = int(input("How many terms? ")) n1, n2 = 0, 1 count = 0 if n <= 0: print("Please enter a positive value") elif n == 1: print("Fibonacci sequence upto",n,":") print(n1) else: print("Fibonacci sequence:") while count < n: print(n1) nth = n1 + n2 n1 = n2 n2 = nth count += 1 Read other Tutorials A simple model of a computer system Binary Number System Basic Programming Programming Tutorials Basic Programmingcomputer science