Tonight I hated julia, REPL and overflows

Hi, welcome!
To find why you got no warning about overflow, google: julia overflow integer. Eg, here is a good thread A plea for int overflow checking as the default

I think the following does what you want

julia> p(n) = 1 - prod(collect(365:-1:(365-n+1))) / 365^n;

julia> p(big(23))
0.50729723432398540722...

This sends an argument of type BigInt. Because of promotion rules, all of the relevant calculations are done with BigInts.

14 Likes