The same birthday by jamesaxl

f=lambda n:[1,0][n>0] or f(n-1)*n\x0d
for i in xrange(2,101,1):\x0d
    r=(f(365))/(f(365-i))\x0d
    print ("n=%d, p=%.8f")%(i,1-(r/365.0**i))

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page