Month 6 starts out with five total rabbits three of which are mature. During the month the mature rabbits gives birth to three babies, so there are eight rabbits at the end of the month.
The updated chart shows the situation.
N | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Rabbits | 1 | 1 | 2 | 3 | 5 | 8 |
Here is what we have been doing:
rabbits At End Of Month( N ) = rabbits At End Of Month( N-1 ) + rabbits Born During Month( N ) rabbits At End Of Month( N ) = rabbits At End Of Month( N-1 ) + mature Rabbits During Month( N ) rabbits At End Of Month( N ) = rabbits At End Of Month( N-1 ) + rabbits At End Of Month( N-2 )
Once you have this rule, to calculate the number of rabbits at the end of a month just add up the numbers for the previous two months.
What is the value for the end of month 7?