Tool to compute numbers of Fibonacci. Fibonacci sequence is a sequence of integers, each term is the sum of the two previous ones.
Fibonacci Numbers - dCode
Tag(s) : Series
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The Fibonacci sequence is an infinite mathematical sequence in which each term is the sum of the two previous terms, usually starting with 0 and 1.
The sequence begins like this: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and so on.
Numbers from the Fibonacci sequence, noted $ F_n $ ou $ F(n) $, are equal to the addition of the 2 previous terms, they follow the recurrence formula: $$ F(n) = F(n-1) + F(n-2) $$ that can be also written $$ F(n+2) = F(n) + F(n+1) $$
To initiate the sequence, by default, the two first terms are $ F(0) = 0 $ and $ F(1) = 1 $
Example: $ F_2 = F_0+F_1 = 0+1 = 1 $
$ F_3 = F_1+F_2 = 1+1 = 2 $
$ F_{10} = F_8+F_9 $, etc.
Any other values of $ F_0 $ and $ F_1 $ will produce different Fibonacci sequences.
Binet's formula allows you to calculate the nth term without having to use recursion or having to calculate the previous terms. The formula is $$ F(n) = \frac{1}{\sqrt{5}}\left(\frac{1+\sqrt{5}}{2}\right)^n - \frac{1}{\sqrt{5}}\left(\frac{1-\sqrt{5}}{2}\right)^n $$ and involves the golden ratio.
Fibonacci sequence first numbers are:
F(0)= | 0 |
---|---|
F(1)= | 1 |
F(2)= | 1 |
F(3)= | 2 |
F(4)= | 3 |
F(5)= | 5 |
F(6)= | 8 |
F(7)= | 13 |
F(8)= | 21 |
F(9)= | 34 |
F(10)= | 55 |
For the next Fibonacci terms, use the calculator above.
Each term in the sequence is equal to the previous multiplied by approximately $ \varphi = 1.618 $ (golden number).
Example: $ F(10) = 55 $, $ 55/\varphi \approx 33.99 $ and in fact $ F(9) = 34 $
The rabbits' growth problem is a problem proposed by Leonardo Fibonacci in 1200.
There is a rabbit couple (male + female) and every month a couple breeds and gives birth to a new pair of rabbits which in turn can reproduce itself after 2 months. How many rabbits will be born after X months?
In the beginning there is 1 couple then
1 month | 1 couple |
two months | 2 couples |
three months | 3 couples |
4 months | 5 couples |
5 months | 8 couples |
6 months | 13 couples |
7 months | 21 couples |
8 months | 34 couples |
Each month, the total number of rabbits is equal to the sum of the numbers of the previous two months because it is the number of existing rabbits (the previous month) plus the number of babies born from rabbits couples who have at least two months (hence the number of rabbits 2 months ago). The numbers found are the numbers of the Fibonacci sequence.
The Lucas sequence is similar to the Fibonacci sequence, but it starts with 2 and 1 (instead of 0 and 1). The recurrence formulas are the same.
A source code to program the calculation of Fibonacci numbers by recurrence://Pseudo-code
function fibonacci(n) {
if (n == 0) return 0
if (n == 1) return 1
return fibonacci(n - 1) + fibonacci(n - 2)
}
And an iterative version of the algorithm //Pseudo-code
function fibonacci(n) {
if (n == 0) return 0
if (n == 1) return 1
prev = 0
curr = 1
for i from 2 to n {
next = prev + curr
prev = curr
curr = next
}
return curr
}
dCode retains ownership of the "Fibonacci Numbers" source code. Any algorithm for the "Fibonacci Numbers" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Fibonacci Numbers" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Fibonacci Numbers" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Fibonacci Numbers" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Fibonacci Numbers on dCode.fr [online website], retrieved on 2025-04-16,