School Gate, four mobile phone tail number pick up the courier. Q: There is a \ (n\) package, there are two package numbers (the recipient phone tail number, assuming uniform distribution ) the same probability of (P (n) \) is how much?
Answer: Mobile phone tail number a total (10^4=10000\), so \ (P (n) =\frac{a_{10000}^n}{(10000) ^n} \), where \ (a_n^r\) is the number of permutations.
The expression is very simple, but the calculation of the value of the trouble: the numerator and denominator are too large, the IEEE 754 floating-point number can not stand, throw me a Infinity directly.
What do we do? Expand the number of permutations, take the logarithm, multiplication to add and subtract:
\ (\log{p (n)} \)
\ (= \log{\frac{a_{10000}^n}{(10000) ^n}} \)
\ (=\log{a_{10000}^n}-n\log{10^4} \)
\ (=\log{10^4 (10^4-1) \cdots (10^4-n+1)}-4n\log{10} \)
\ (=\log{10^4}+\log{(10^4-1)}+\cdots+\log{(10^4-n+1)}-4nlog{10} \)
If you don't want to be so troublesome, there are very precise factorial approximation formulas available (this is not limited to integers):
\ (\left\{\begin{matrix} n! = \gamma (n+1) \ \ln\gamma (z) \approx \tfrac{1}{2} \left[\ln (2\PI)-\ln Z\right] + z\left[\ln \left (z + \frac{1}{12z-\frac{1}{10z}}\right)-1\right] \end{matrix}\right. \)
In a word, we can figure out the exact number at the end. The probability of n taking certain special values is listed below:
N |
20 |
40 |
60 |
80 |
100 |
120 |
140 |
160 |
180 |
200 |
P (N) |
2% |
8% |
16% |
27% |
39% |
51% |
62% |
72% |
80% |
87% |
\ ([20, 200]\) within the range \ (y=p (x) \) The function image is as follows (only \ (x\) equals the integer point has practical meaning):
It looks a bit counterintuitive: what's the probability of repetition so big? It's really so big, as long as the phone tail number is evenly distributed.
However, the probability that one's own number is the same as a person's number (there is a person with himself) is not very large:
Therefore, the probability of the heavy number is not small, but the probability of their own encounter is very small. (But the big scary number probability is very counter-intuitive ...) )
The mathematical problem of taking express delivery: The repetition probability of mobile phone tail number