Python Program: Generating the Fibonacci Sequence

 Understanding Numerical Series:    

         Before diving into specific types like the Fibonacci sequence, it's important to understand the fundamentals of numerical series.


What is a Numerical Series?

          A numerical series is a collection of  numbers where each  number has
relationship with other numbers.


Exploring the Fibonacci sequence:

            Fibonacci series is a type of number sequence where each number is an sum of previous two numbers.

For example:

         2, 3, 5, 8, 13,......,n

In this sequence  you can observe  that the sum of first two elements, 2 and 3, equals the third element. Similarly  you can add second and third elements, the third and fourth elements and so on. Clearly, the sum of any two elements will yield the next element in the sequence.

 

Program:

Using while loop:

     
a = 0
b = 1
size = int(input("Enter size of series:"))
print(a,"\n ",b)
n = 0
while n > size-2:
	c = a+b
	print(c)
	a = b
	b = c
	n = n+1



  

Comments

Popular posts from this blog

Why?

மரணம்