Problem of counting pigs
There are N pigs in a hog log. Select Q of them once. Then put them back. After M times selecting, ask the expectation value of the number (k) of pigs that have ever been selected.
The code
- simulates the process of selecting pigs.
- gives recursion formula of the probability of (n, m, q, k) event.
That is, select from$n$ pigs$m$ times with$q$ each time that results in$k$ pig(s) been selected.
- Ning Sun, [email protected]