The Birthday Problem (n>30) I am trying to figure out that what is the probability that at least 40 people share the same birthday out of 350? Calculator gives an error when I try to calculate $^{365}P_{40}$. Please help!

It will be a tiny number.  An approximation is ${350 \choose 40}365^{-39}$ because you choose $40$ people to share a birthday then make the last $39$ match the first.  This is an overestimate, because it double counts cases where there are two sets, but that won't matter. We use Stirling's approximation (ignoring even the $\sqrt {2 \pi n}$)for the log of the number $$\log{350 \choose 40}365^{-39}=\log \frac {350!}{40!315!}365^{-39}\\ \approx 350 \log 350 -40 \log 40 -315 \log315 -39 \log 365\\ \approx -139\\ \text{Probability} \approx 2.78 \cdot 10^{-61} $$
