Insect Population Control

Field biologists run a field experiment over nn days to assess the population of an invasor insect species.

An insect trap is set on the first day, and a new trap is added every day, so on the iith day, ii traps are deployed. Each trap is expected to capture KK individuals. However, specimens learn to avoid traps, so the effectiveness of the traps decays with time.

For this, the expected number of captured individuals on the ii-th day is: Ei=K*ii!E_i = \frac{K*i}{i!} Thus, the accumulated number of captures after nn days of field work will be: C(n)=i=1nK*ii!C(n) = \sum_{i=1}^{n}\frac{K*i}{i!}

Write a function captures(n,K) that receives two integers: the number of days of the field experiment (nn) and the expected captures per trap (KK) and returns the expected accumulated number of captures C(n)C(n) at the end of the field experiment.

Observation

Problem information

Author: Lluís Padró

Generation: 2026-01-25T12:57:16.870Z

© Jutge.org, 2006–2026.
https://jutge.org