figure out how many generations it will take for a start value of bunnies to reach 20,000. Where every pair of bunnies has 3 bunnies each time through.
Here is what i'm trying to do. 10 will make 5 pairs. 5 pairs will make 15 offsprings (since it's 5*3). For the first generation it's 10+15=25 which will make 12 pairs with will make 36 offsprings. For the second generation its 25+36=71 and so on until it reaches 20,000> How many generations did it take me. (The time and lifespan are not a part of this program.)
Examples:
Start = 10 (with 10 bunnies) Return = 9 (Number of generations)
Start = 20 (with 20 bunnies) Return = 8 (Number of generations)
Aucun commentaire:
Enregistrer un commentaire