(Text for the premise taken from the internet)
Consider the growth of an idealized (biologically unrealistic) rabbit population, assuming that:
- a newly born pair of rabbits, one male, one female, are put in a field;
- rabbits are able to mate at the age of one month so that at the end of its second month a female can produce another pair of rabbits;
- rabbits never die;
- a mating pair always produces one new pair (one male, one female) every month from the second month on.
Task.
- At month 1 there is one pair of rabbits. Work out how many pairs there will be after two months, after three months, after four months, and after one year.
- Formulate a piecewise recursive expression for the number of mating pair, after the n'th month. Hint.
- Create the project, Rabbit, and implement the recursive method public long pairs(int n) using your piecewise definition.
- What sequence is this?