# 代做program课程作业、代写Java，c++，Python程序语言作业、代做data作业帮做C/C++编程|代写Python编程

Consider a population of "prime insects" and "even eating predators". In all possible scenarios we are considering, there are i insects to begin with (where i >= 50 and i is an even number) and p predators (where p >= 5) to begin with (week 0). Given these initial numbers, the insect population at the end of week n is calculated as follows in the following order:
1.For each week w up until and including week n, if w is a prime number that is greater than or equal to 3 (i.e. 3, 5, 7, 11 …), then half of the insects in the population give birth to two more insects, resulting in x insects
2.After any reproduction from #1 (the rule stated above), the resulting number x can be reduced in two ways:
oFor each week n where n is an even number, each of the predators eats 2 insects. This eating is such that predators will select their prey strictly in order from youngest to oldest; if a predator p eats an insect i, then there are no insects younger than i remaining.
oAll insects born 10 weeks prior to week n that are still alive naturally die off.
Suppose that i = 50 and p = 5. Then the sequence for the first 13 weeks would look like the following list (there are 14 items because we are including week 0 in the first position):
[50, 50, 40, 80, 70, 140, 130, 260, 250, 250, 200, 400, 390, 750]
Notice that at week 10, when insects first start naturally dying, the number goes down to 200, because predators ate 10 of the youngest insects (week 10 is an even numbered week) and the 40 remaining insects from week 0 (10 of the initial 50 were eaten in week 2) naturally died off. No new insects are born between Weeks 0 and 2. Week 13 sees 750 insects, because numbers doubled from 390 the previous week (to get 780), but that number is reduced by 30 to 750 because of the 40 born in week 3, 10 were eaten in week 4 and so only 30 naturally die out.
Given inputs i (number of initial insects), p (number of initial predators) and n (number of weeks), your program should calculate the number of insects (z) calculated to be alive after n weeks and output the following string:
There are z insects at week n
You may assume that the 3 inputs into this program will be valid: all integers, i >= 50 and i is an even number, and p >= 5.
Note that given this setup, for some inputs the number sequence will get to a point where at some week w the population falls to 0, which means that by that week the population of insects (and subsequently predators) became extinct. For example, suppose that i = 52 and p = 12. Then the sequence to week 12 is the following, and at week 12 the population became extinct:
[52, 52, 28, 56, 32, 64, 40, 80, 56, 56, 4, 8, 0]
Here, the population at week 11 is 8, but due to predators eating that remaining amount in week 12, the numbers go down to zero. In such cases, your output should instead be:
The insects became extinct at week 12
Example 1:
What is the number of weeks? 17
How many insects to begin with? 50
How many predators to begin with? 5
There are 1230 insects at week 17
Example 2:
What is the number of weeks? 5
How many insects to begin with? 100
How many predators to begin with? 10
There are 280 insects at week 5
Example 3:
What is the number of weeks? 21
How many insects to begin with? 82
How many predators to begin with? 10
There are 2950 insects at week 21
Example 4:
What is the number of weeks? 18
How many insects to begin with? 50
How many predators to begin with? 11
The insects became extinct at week 15

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp2 