Fibonacci Sequence
Explore how to model the Fibonacci sequence using Ruby by simulating rabbit population growth over a year. Learn to analyze problem patterns, implement variable assignments, and generate sequences while reinforcing core programming concepts.
Problem
Start with a pair of rabbits (one male and one female) born on January 1. Assume that all months are of equal length and that:
The first pair of rabbits reproduced two months after their own birth.
After two months of age, each pair produces a mixed pair (one male and one female), and then another mixed pair every month.
No rabbit dies.
Find out how many pairs will there be at the end of each month of the first year. Store the numbers in an array called array ...
The number of rabbit pairs are:1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
Finding the number of pairs produced every month of the year
Purpose
Analyze the ...