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.
‘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 .
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 ..
# 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.] .
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Find fibonacci series upto n using lambda
- Create Pandas Series using NumPy functions
- Python | Pandas series.cumprod() to find Cumulative product of a Series
- Python | Pandas Series.str.replace() to replace text in a series
- Python | Pandas Series.astype() to convert Data type of series
- Python | Pandas Series.cumsum() to find cumulative sum of a Series
- Python | Pandas series.cummax() to find Cumulative maximum of a series
- Python | Pandas Series.cummin() to find cumulative minimum of a series
- Python | Pandas Series.nonzero() to get Index of all non zero values in a series
- Python | Pandas Series.mad() to calculate Mean Absolute Deviation of a Series
- Python IMDbPY – Getting series details fro the series id
- Python IMDbPY – Getting series years of the series
- Add a Pandas series to another Pandas series
- Convert a series of date strings to a time series in Pandas Dataframe
- Convert Series of lists to one Series in Pandas
- Converting Series of lists to one Series in Pandas
- Pandas - Get the elements of series that are not present in other series
- Creating Series from list, dictionary, and numpy array in Pandas
- Convert a NumPy array to a Pandas series
- Python | Numpy numpy.resize()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.