
Binarium
Best Binary Options Broker 2020!
Perfect For Beginners!
Free Demo Account!
Free Trading Education!
Get Your SignUp Bonus Now!
Fibonacci Sequence
The Fibonacci Sequence is the series of numbers:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, .
The next number is found by adding up the two numbers before it.
 The 2 is found by adding the two numbers before it (1+1)
 The 3 is found by adding the two numbers before it (1+2),
 And the 5 is (2+3),
 and so on!
Example: the next number in the sequence above is 21+34 = 55
It is that simple!
Here is a longer list:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, .
Can you figure out the next few numbers?
Makes A Spiral
When we make squares with those widths, we get a nice spiral:
Do you see how the squares fit neatly together?
For example 5 and 8 make 13, 8 and 13 make 21, and so on.
The Rule
The Fibonacci Sequence can be written as a “Rule” (see Sequences and Series).

Binarium
Best Binary Options Broker 2020!
Perfect For Beginners!
Free Demo Account!
Free Trading Education!
Get Your SignUp Bonus Now!
First, the terms are numbered from 0 onwards like this:
n =  0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  . 
x_{n} =  0  1  1  2  3  5  8  13  21  34  55  89  144  233  377  . 
So term number 6 is called x_{6} (which equals 8).
Example: the 8th term is
the 7th term plus the 6th term:
So we can write the rule:
Example: term 9 is calculated like this:
Golden Ratio
And here is a surprise. When we take any two successive (one after the other) Fibonacci Numbers, their ratio is very close to the Golden Ratio “φ” which is approximately 1.618034.
In fact, the bigger the pair of Fibonacci Numbers, the closer the approximation. Let us try a few:
1.666666666. 1.618055556. 1.618025751.Note: this also works when we pick two random whole numbers to begin the sequence, such as 192 and 16 (we get the sequence 192, 16, 208, 224, 432, 656, 1088, 1744, 2832, 4576, 7408, 11984, 19392, 31376, . ):
It takes longer to get good values, but it shows that not just the Fibonacci Sequence can do this!
Using The Golden Ratio to Calculate Fibonacci Numbers
And even more surprising is that we can calculate any Fibonacci Number using the Golden Ratio:
The answer always comes out as a whole number, exactly equal to the addition of the previous two terms.
When I used a calculator on this (only entering the Golden Ratio to 6 decimal places) I got the answer 8.00000033. A more accurate calculation would be closer to 8.
Try it for yourself!
You can also calculate a Fibonacci Number by multiplying the previous Fibonacci Number by the Golden Ratio and then rounding (works for numbers above 1):
Example: 8 × φ = 8 × 1.618034. = 12.94427. = 13 (rounded)
Some Interesting Things
Here is the Fibonacci sequence again:
n =  0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  . 
x_{n} =  0  1  1  2  3  5  8  13  21  34  55  89  144  233  377  610  . 
There is an interesting pattern:
 Look at the number x_{3} = 2. Every 3rd number is a multiple of 2 (2, 8, 34, 144, 610, . )
 Look at the number x_{4} = 3. Every 4th number is a multiple of 3 (3, 21, 144, . )
 Look at the number x_{5} = 5. Every 5th number is a multiple of 5 (5, 55, 610, . )
And so on (every nth number is a multiple of x_{n}).
1/89 = 0.011235955056179775.
Notice the first few digits (0,1,1,2,3,5) are the Fibonacci sequence?
In a way they all are, except multiple digit numbers (13, 21, etc) overlap, like this:
0.0 
0.01 
0.001 
0.0002 
0.00003 
0.000005 
0.0000008 
0.00000013 
0.000000021 
. etc . 
0.011235955056179775. = 1/89 
Terms Below Zero
The sequence works below zero also, like this:
n =  .  6  5  4  3  2  1  0  1  2  3  4  5  6  . 
x_{n} =  .  8  5  3  2  1  1  0  1  1  2  3  5  8  . 
(Prove to yourself that each number is found by adding up the two numbers before it!)
In fact the sequence below zero has the same numbers as the sequence above zero, except they follow a ++ . pattern. It can be written like this:
Which says that term “n” is equal to (в€’1) n+1 times term “n”, and the value (в€’1) n+1 neatly makes the correct 1,1,1,1. pattern.
History
Fibonacci was not the first to know about the sequence, it was known in India hundreds of years before!
About Fibonacci The Man
His real name was Leonardo Pisano Bogollo, and he lived between 1170 and 1250 in Italy.
“Fibonacci” was his nickname, which roughly means “Son of Bonacci”.
As well as being famous for the Fibonacci Sequence, he helped spread HinduArabic Numerals (like our present numbers 0,1,2,3,4,5,6,7,8,9) through Europe in place of Roman Numerals (I, II, III, IV, V, etc). That has saved us all a lot of trouble! Thank you Leonardo.
Fibonacci Day
Fibonacci Day is November 23rd, as it has the digits “1, 1, 2, 3” which is part of the sequence. So next Nov 23 let everyone know!
What Is the Fibonacci Sequence?
The Fibonacci sequence is one of the most famous formulas in mathematics.
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, and so on. The mathematical equation describing it is Xn+2= Xn+1 + Xn
A mainstay of highschool and undergraduate classes, it’s been called “nature’s secret code,” and “nature’s universal rule.” It is said to govern the dimensions of everything from the Great Pyramid at Giza, to the iconic seashell that likely graced the cover of your school math textbook.
And odds are, almost everything you know about it is wrong.
Scattered history
So then, what’s the real story behind this famous sequence?
Many sources claim it was first discovered or “invented” by Leonardo Fibonacci. The Italian mathematician, who was born around A.D. 1170, was originally known as Leonardo of Pisa, said Keith Devlin, a mathematician at Stanford University. Only in the 19th century did historians come up with the nickname Fibonacci (roughly meaning, “son of the Bonacci clan”), to distinguish the mathematician from another famous Leonardo of Pisa, Devlin said. [Large Numbers that Define the Universe]
But Leonardo of Pisa did not actually discover the sequence, said Devlin, who is also the author of “Finding Fibonacci: The Quest to Rediscover the Forgotten Mathematical Genius Who Changed the World,” (Princeton University Press, 2020). Ancient Sanskrit texts that used the HinduArabic numeral system first mention it, and those predate Leonardo of Pisa by centuries.
“It’s been around forever,” Devlin told Live Science.
However, in 1202 Leonardo of Pisa published the massive tome “Liber Abaci,” a mathematics “cookbook for how to do calculations,” Devlin said. Written for tradesmen, “Liber Abaci” laid out HinduArabic arithmetic useful for tracking profits, losses, remaining loan balances and so on, Devlin said.
In one place in the book, Leonardo of Pisa introduces the sequence with a problem involving rabbits. The problem goes as follows: Start with a male and a female rabbit. After a month, they mature and produce a litter with another male and female rabbit. A month later, those rabbits reproduce and out comes — you guessed it — another male and female, who also can mate after a month. (Ignore the wildly improbable biology here.) After a year, how many rabbits would you have? The answer, it turns out, is 144 — and the formula used to get to that answer is what’s now known as the Fibonacci sequence. [The 11 Most Beautiful Mathematical Equations]
“Liber Abaci” first introduced the sequence to the Western world. But after a few scant paragraphs on breeding rabbits, Leonardo of Pisa never mentioned the sequence again. In fact, it was mostly forgotten until the 19th century, when mathematicians worked out more about the sequence’s mathematical properties. In 1877, French mathematician Édouard Lucas officially named the rabbit problem “the Fibonacci sequence,” Devlin said.
The Fibonacci sequence and golden ratio are eloquent equations but aren’t as magical as they may seem. (Image credit: Shutterstock)
Imaginary meaning
But what exactly is the significance of the Fibonacci sequence? Other than being a neat teaching tool, it shows up in a few places in nature. However, it’s not some secret code that governs the architecture of the universe, Devlin said.
It’s true that the Fibonacci sequence is tightly connected to what’s now known as the golden ratio (which is not even a true ratio because it’s an irrational number). Simply put, the ratio of the numbers in the sequence, as the sequence goes to infinity, approaches the golden ratio, which is 1.6180339887498948482. From there, mathematicians can calculate what’s called the golden spiral, or a logarithmic spiral whose growth factor equals the golden ratio. [The 9 Most Massive Numbers in Existence]
The golden ratio does seem to capture some types of plant growth, Devlin said. For instance, the spiral arrangement of leaves or petals on some plants follows the golden ratio. Pinecones exhibit a golden spiral, as do the seeds in a sunflower, according to “Phyllotaxis: A Systemic Study in Plant Morphogenesis” (Cambridge University Press, 1994). But there are just as many plants that do not follow this rule.
“It’s not ‘God’s only rule’ for growing things, let’s put it that way,” Devlin said.
And perhaps the most famous example of all, the seashell known as the nautilus, does not in fact grow new cells according to the Fibonacci sequence, he said.
When people start to draw connections to the human body, art and architecture, links to the Fibonacci sequence go from tenuous to downright fictional.
“It would take a large book to document all the misinformation about the golden ratio, much of which is simply the repetition of the same errors by different authors,” George Markowsky, a mathematician who was then at the University of Maine, wrote in a 1992 paper in the College Mathematics Journal.
Much of this misinformation can be attributed to an 1855 book by the German psychologist Adolf Zeising. Zeising claimed the proportions of the human body were based on the golden ratio. The golden ratio sprouted “golden rectangles,” “golden triangles” and all sorts of theories about where these iconic dimensions crop up. Since then, people have said the golden ratio can be found in the dimensions of the Pyramid at Giza, the Parthenon, Leonardo da Vinci’s “Vitruvian Man” and a bevy of Renaissance buildings. Overarching claims about the ratio being “uniquely pleasing” to the human eye have been stated uncritically, Devlin said.
All these claims, when they’re tested, are measurably false, Devlin said.
“We’re good pattern recognizers. We can see a pattern regardless of whether it’s there or not,” Devlin said. “It’s all just wishful thinking.”
Fibonacci sequence explained – Who is Fibonacci?
I am currently enrolled at Launch School in order to learn the art of programming. During the section where we learn about recursion, the Fibonacci sequence is used to illustrate the concept.
Below is a recursive method, written in Ruby, to find the nth number in the Fibonacci sequence. I will attempt to explain how this method works using the code as well as a tree diagram as presented in the Launch School course.
In maths, the Fibonacci sequence is described as : the sequence of numbers where the first two numbers are 0 and 1, with each subsequent number being defined as the sum of the previous two numbers in the sequence.
The Fibonacci sequence looks like this:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 and so on.
Take a look at the code shown below. Even if you do not know Ruby at all, it should make some sense to you. The mindtwisting part (for those new to programming) comes in where the code inside the fibonacci() method calls itself not once but twice (3rd last line)!
This is of course what recursion is. A method or function that calls itself until some exit condition is reached. The exit condition here is the first part of the ‘ if’ statement and is met when the method variable number is smaller than 2.
To start with, let’s also look at the tree structure in the diagram below:
For now, only look at the leftmost three blocks. The ones that have f(2) and then under that f(1) and f(0).
This is the small tree for fibonacci(2), i.e. for finding the 2nd element in the Fibonacci sequence (we start counting at 0).
We begin by feeding the fibonacci method the value of 2, as we want to calculate fibonacci(2). You can see from the method code that we end up in the ‘ else’ section of the ‘ if’ statement (as number = 2, which is not smaller than 2).
The following line of code is now about to be executed:
Replace ‘ number’ with the value 2 and the line of code becomes:
The next step is to find the values of the two terms, fibonacci(1) and fibonacci(0). The computer will need to call the fibonacci method for each of these two terms. This is where the recursion comes in.
In order to do the evaluation and make use of the fibonacci method, while the program is already currently inside the fibonacci method, the computer will store the current state or instance of the fibonacci method (we can call this instance ‘fibonacci(2)’ ), and then evaluate fibonacci(1). It will get a result of 1 because of the two lines of code shown below, and with number = 1. In Ruby the code do not have to read “return number”, it only needs to state the variable whose value is to be returned. Hence, number is returned as can be seen in the 2nd line below (which will return 1 in this case).
Ruby will store this value as the result of fibonacci(1), and continue to evaluate fibonacci(0). The same two lines of code above will result in a value of 0 (zero) when fibonacci(0) is evaluated.
There are no more recursion operations left to do as both terms in the line of code have been resolved to actual values:
fibonacci(2) = fibonacci(1) + fibonacci(0) = 1 + 0 = 1
On the tree structure in the diagram, we have resolved f(0) = 0 and also f(1) = 1. This allows us to resolve f(2), which is f(1) + f(0) = 1.
It may help to think in terms of the time dimension and different ‘instances’ of the fibonacci method here. Each time a recursive call is made to the fibonacci method, the current state, or instance, of the method is stored in memory (the stack), and a new value is passed to the method for the next instance of the method to use. As each term is resolved to the value 0 or 1, the previous instance of the method can be resolved to an actual value. The result is that the line of code:
can now be resolved by adding the two values. This result is then returned to the previous instance of the fibonacci method in order to again help with the line of code’s resolution to actual values in that instance. The adding of the two terms continue in this manner, until all the terms in the equation is resolved to actual values, with the total then returned to the code which called the fibonacci method in the first place.
As an example, if we wanted to calculate fibonacci(3), we know from the definition of the Fibonacci sequence that:
And, using the recursive method, we get to the line of code above which reflects this definition:
fibonacci(2) is further recursively resolved to:
Which leads us to the end result:
fibonacci(3) = (fibonacci(1) + fibonacci(0)) + fibonacci(1)
which evaluates/resolves to:
And, as we can see in the blocks shown in the corresponding tree structure:
The tree structure diagram and its relation to the recursive fibonacci method should make more sense now. Recursion will happen till the bottom of each branch in the tree structure is reached with the resulting value of 1 or 0. During recursion these 1’s and 0’s are added till the value of the Fibonacci number is calculated and returned to the code which called the fibonacci method in the first place.
The recursive method (algorithm) ‘unwinds’ the number you give it until it can get an actual value (0 or 1), and then adds that to the total. The “unwinding” takes place each time the value of ‘number2’ and the value of ‘number1’ is given to the fibonacci method when the line
is evaluated. Note that the value of ‘number2’ in this case is the value of the next instance of the fibonacci method’s variable number (next recursive loop). The same goes for the value of ‘number1’.
With each recursion where the method variable number is NOT smaller than 2, the state or instance of the fibonacci method is stored in memory, and the method is called again. Each time the fibonacci method is called though, the value passed in is less than the value passed in during the previous recursive call (by either 1 or 2). This goes on until the value returned is a value smaller than 2 (either 0 or 1). The resolution of the previous instance can then be done. In one instance, 0 is returned and fibonacci(0) can be resolved to 0. In another, 1 is returned and fibonacci(1) can be resolved to 1.
These values are then summed in order to obtain the requested Fibonacci number. This summing action happens each time a 0 or 1 is returned from one instance of the fibonacci method to the previous instance of the fibonacci method, and so on.
This is equivalent to where all the 1’s and 0’s at the bottom of the tree structure are added together. The final sum (or total) of all these 0’s and 1’s is then the value of the Fibonacci number requested in the first place. This value is returned during the final return of the fibonacci method to where the method was called from in the first place.
It is important to note that, except for the case where we want to know what the values of fibonacci(0) or fibonacci(1) is, the final return value of the requested Fibonacci number will come from the following line of code in the method:
Also note that in this scenario, where the value of any Fibonacci number greater than 1 is to be calculated, the lines of code:
will only be used during the recursive process.
I hope my explanation did not confuse you further, but helped in your understanding of both what the Fibonacci sequence is, and how we use recursion in Ruby to calculate the numbers in the sequence.

Binarium
Best Binary Options Broker 2020!
Perfect For Beginners!
Free Demo Account!
Free Trading Education!
Get Your SignUp Bonus Now!