This is a quote from the book "Bitcoin: A Peer-to-Peer Electronic Cash System" by Satoshi Nakamoto
...oisson distribution with expected value:

To get the probability the attacker could still catch up now, we multiply the Poiss
on density for each amount of progress he could have made by the probability he could catch up from that point:

to avoid summing the infinite tail of the distribution...

Converting to C code...

read full book block explorer