Fibonacci Sequence

Learn to find patterns by working out the solution for the Fibonacci sequence.

We'll cover the following

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.

Get hands-on with 1400+ tech skills courses.