How does the flower exhibit the Fibonacci number
Fibonacci sequence
The Fibonacci sequence is a series of numbers in which each number is the result of adding together the two preceding numbers. It starts with 0 and 1, and the sequence continues as 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on.
Fibonacci spiral
Fibonacci in a spiral is a mathematical and artistic concept. We can create a sequence of squares with side lengths corresponding to Fibonacci numbers, and we can arrange them in a spiral pattern. The next number in the Fibonacci sequence determines each square’s side length.
Let’s look at the sequence below:
Let’s discuss how it works:
-
We add a square with a side length of 1 unit.
-
We add another square with a side length of 1 unit adjacent to the first square.
-
We continue adding squares with side lengths corresponding to Fibonacci numbers (1, 2, 3, 5, 8, 13, etc.), positioning them in a spiral pattern.
Fibonacci spiral in seashells
The Fibonacci spiral appears in the patterns of seashells, specifically in the arrangement of the shell chambers.
The sea animal, nautilus, grows its shell in a spiral pattern. As the animal inside the shell grows, it adds new chambers to accommodate itself. Each new chamber is larger than the previous one and this growth follows the Fibonacci sequence in terms of the number of chambers added.
Look at the image below to visualize the seashell pattern:
The center of a flower exhibits the Fibonacci sequence
Many flowers, like sunflowers, showcase a spiral pattern that follows the Fibonacci sequence. The seeds in the center of a sunflower are arranged in spirals that follow the Fibonacci sequence.
Look at the sunflower image below:
Note: Not all flowers with spiral arrangements follow the Fibonacci sequence, but many do. The appearance of these mathematical patterns in nature has been the subject of many scientific investigations.
Let’s write down a code below that prints a Fibonacci series:
#include <iostream>using namespace std;int main() {int numTerms = 9; // Number of terms in the Fibonacci seriesint firstTerm = 0; // First term of the seriesint secondTerm = 1; // Second term of the seriescout << firstTerm << ", " << secondTerm << ", "; // Print the first two termsfor (int i = 2; i < numTerms; i++) {int nextTerm = firstTerm + secondTerm; // Compute the next termcout << nextTerm;if (i != numTerms - 1) {cout << ", "; // Add comma if it's not the last term}// Shift terms for the next iterationfirstTerm = secondTerm;secondTerm = nextTerm;}cout <<endl; // Move to the next linereturn 0;}
Explanation
-
Line 5: The
numTermsvariable is set to9, which represents the desired number of terms in the Fibonacci series. -
Line 6: The
firstTermvariable is initialized with0, representing the first term of the series. -
Line 7: The
secondTermvariable is initialized with1, representing the second term of the series. -
Line 11: A
forloop is used to generate the remaining terms of the Fibonacci series. The loop starts fromi = 2because the first two terms have already been printed in line 9. -
Line 12: The
nextTermvariable is computed by adding the previous two terms (firstTermandsecondTerm). -
Line 20–21: The
firstTermandsecondTermvariables will be updated for the next Fibonacci number.
Free Resources