The same birthday by tttaki

import Text.Printf
f::Int->Double
f n=1-(product$map(\x->1-x/365)[1..fromIntegral$n-1])
main=mapM(s(printf"n=%d, p=%.8f\n")f)[2..100]where s f g x=f x$g x

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

download

return to the top page