VOOZH about

URL: https://www.geeksforgeeks.org/python/numpy-fibonacci-series-using-binet-formula/

⇱ NumPy - Fibonacci Series using Binet Formula - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

NumPy - Fibonacci Series using Binet Formula

Last Updated : 3 Jun, 2020
All of us are familiar with Fibonacci Series. Each number in the sequence is the sum of the two numbers that precede it. So, the sequence goes: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34...... In this tutorial, we will implement the same using NumPy with the aid of Binet formula. Binet Formula ā€˜n’ is the parameter which relates the first ā€˜n’ numbers of Fibonacci Series. In the first example we are going to findout first 10 numbers of Fibonacci Series (n = 10), after that we takes the parameter ā€˜n’ from user and produce the corresponding result. NOTE : We are ignoring the first element(0) of Fibonacci Series Example 1: To find first 10 Fibonacci numbers . Output :
The first 10 numbers of Fibonacci series are [ 1. 1. 2. 3. 5. 8. 13. 21. 34. 55.] .
Example 2 : To find first 'n' Fibonacci numbers ..
Output :
# Here user input was 10
Enter the value of n+1'th number :10
The first 9 numbers of Fibonacci series are [ 1. 1. 2. 3. 5. 8. 13. 21. 34.] . 
Comment