#1-C(365,n)n!/(365)^n init=365 k=0 for(n in 4:init){ pk=1-choose(365,n)*factorial(n)/365^n if(pk>=0.5){ k=n; break; } } print(k) choose(n,k) factorial(5) choose(4,2) #组合 #sqrt(x)